diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/osm_controller.js b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/osm_controller.js index a951172d..bb87d571 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/osm_controller.js +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/controllers/osm_controller.js @@ -1,5 +1,16 @@ import { Controller } from '@hotwired/stimulus' import L from 'leaflet' +import iconUrl from 'leaflet/dist/images/marker-icon.png' +import iconRetinaUrl from 'leaflet/dist/images/marker-icon-2x.png' +import shadowUrl from 'leaflet/dist/images/marker-shadow.png' + +// Icon.Default finds its images by reading the url() off .leaflet-default-icon-path and +// stripping a literal `marker-icon.png` off the end - which a content-hashed filename never +// matches, and the `link[href$="leaflet.css"]` fallback does not exist either because the +// CSS is inlined into the bundle. Dropping the _getIconUrl override falls back to plain +// option lookup, so the URLs Webpack emitted are used as they are. +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ iconUrl, iconRetinaUrl, shadowUrl }) export default class extends Controller { diff --git a/webpack.config.js b/webpack.config.js index cf4a8f72..b7092e87 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -42,7 +42,6 @@ Encore .copyFiles([ { from: './public/typo3conf/ext/ep_theme/Resources/Private/Assets/images', to: 'images/[name].[ext]' }, { from: './public/typo3conf/ext/ep_theme/Resources/Private/Assets/images/icons', to: 'images/icons/[name].[ext]' }, - { from: './node_modules/leaflet/dist/images', to: 'images/[name].[ext]' }, ]) // The content hash is what lets .htaccess serve these as `immutable` for a year: a new // build is a new URL, so a browser never has to revalidate one. It also replaces TYPO3's