The esbuild bundle wraps everything in a 'use strict' IIFE, causing the leaflet UMD module to take the CommonJS path instead of setting window.leaflet. The entry point check window.leaflet && !window.L always failed, so window.L was never assigned and the map never initialized. - Add leaflet-global.js to import leaflet-minimal and set window.L before plugins execute (ESM source-order evaluation guarantees this) - Replace the broken window.leaflet check in map-bundle-entry.js with an import of leaflet-global.js
7 lines
350 B
JavaScript
7 lines
350 B
JavaScript
// Sets window.L from the imported leaflet module.
|
|
// Required because esbuild bundles everything in a "use strict" IIFE,
|
|
// causing the leaflet UMD to take the CommonJS path instead of setting
|
|
// window.leaflet. Plugins and hooks expect window.L to exist.
|
|
import * as leafletModule from "../vendor/js/leaflet-minimal.js";
|
|
|
|
window.L = leafletModule;
|