Use correct name for Leaflet global#10027
Conversation
|
@simon04 FYI |
There was a problem hiding this comment.
Pull request overview
This PR updates the Leaflet build configuration to expose the library's global variable as L instead of leaflet, aligning with standard Leaflet conventions. It removes the custom global exposure logic in LeafletWithGlobals.js and delegates this responsibility to Rollup's UMD format configuration, while also ensuring the AMD module is correctly registered with the package name.
- Changes the Rollup UMD output configuration to use
Las the global name instead ofleaflet - Removes
LeafletWithGlobals.jswhich contained custom global exposure and noConflict logic - Adds AMD configuration to register the module with the name
leafletfor RequireJS compatibility - Adds three test HTML files to verify ESM, global, and AMD distribution methods work correctly
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/LeafletWithGlobals.js | Deleted file that previously handled custom global exposure and noConflict functionality |
| build/rollup-config.js | Updated input to use Leaflet.js directly, changed global name from 'leaflet' to 'L', added AMD configuration, and added noConflict option |
| package.json | Added requirejs dev dependency for AMD testing |
| package-lock.json | Lock file updates for requirejs dependency |
| debug/tests/dist-global.html | New test file for verifying global distribution using the L global variable |
| debug/tests/dist-esm.html | New test file for verifying ESM distribution via import statements |
| debug/tests/dist-amd.html | New test file for verifying AMD distribution with RequireJS |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
66be5a0 to
27077d0
Compare
|
The tests are failing because the ESM version no longer has a default export. I think we should get rid of it anyways, marking this as a draft for now. |
27077d0 to
d0168ad
Compare
Signed-off-by: Jon Koops <jonkoops@gmail.com>
d0168ad to
dc7da57
Compare
Changes the Rollup configuration to expose the Leaflet global as
Linstead ofleaflet, and ensures the AMD loader works correctly with the same name as the package (leaflet). The various distributions can be tested using the files located in thedebug/testsdirectory (specificallydist-esm.html,dist-amd.htmlanddist-global.html).This also removes the custom logic to expose the global and instead defers this to Rollup, this also means the ESM version no longer exposes a global variable, which is the correct behavior for that distribution.