fix: resolve leaflet marker images through webpack

This commit is contained in:
fromme committed 2026-09-26 09:35:58 +02:00
1 parent f10d784a5c
commit e96dd0f06d
2 files changed
+11 -1

No files matched your search

@@ -1,5 +1,16 @@
import { Controller } from '@hotwired/stimulus' import { Controller } from '@hotwired/stimulus'
import L from 'leaflet' 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 { export default class extends Controller {
-1
View File
@@ -42,7 +42,6 @@ Encore
.copyFiles([ .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', to: 'images/[name].[ext]' },
{ from: './public/typo3conf/ext/ep_theme/Resources/Private/Assets/images/icons', to: 'images/icons/[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 // 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 // build is a new URL, so a browser never has to revalidate one. It also replaces TYPO3's