refactor: bundle all vendor deps into spotmap-map.js, drop copy-deps#44
Merged
Conversation
Import Leaflet, all plugins, Font Awesome, and custom CSS directly in src/map-engine/index.ts so webpack packs everything into the single build/spotmap-map.js + build/spotmap-map.css output. This eliminates the copy-deps.js script and the public/ vendor subdirectories entirely. window.L is explicitly assigned after import so future Leaflet plugins loaded as separate <script> tags still find the global, matching the behaviour of the old enqueue-based approach. Fixes a class of issues where WordPress caching/optimisation plugins reorder or concatenate the previously separate Leaflet script tags and break the dependency chain. https://claude.ai/code/session_01AAsqtsybGk9VPJ4FmggxBC
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
techtimo
added a commit
that referenced
this pull request
Apr 15, 2026
…44) * refactor: bundle all vendor deps into spotmap-map.js, drop copy-deps Import Leaflet, all plugins, Font Awesome, and custom CSS directly in src/map-engine/index.ts so webpack packs everything into the single build/spotmap-map.js + build/spotmap-map.css output. This eliminates the copy-deps.js script and the public/ vendor subdirectories entirely. window.L is explicitly assigned after import so future Leaflet plugins loaded as separate <script> tags still find the global, matching the behaviour of the old enqueue-based approach. Fixes a class of issues where WordPress caching/optimisation plugins reorder or concatenate the previously separate Leaflet script tags and break the dependency chain. https://claude.ai/code/session_01AAsqtsybGk9VPJ4FmggxBC * fix global var
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/map-engine/index.tsso webpack packs everything into the singlebuild/spotmap-map.js+build/spotmap-map.cssoutputscripts/copy-deps.jsand eliminates thepublic/vendor subdirectories entirelywp_enqueue_script/wp_enqueue_stylecalls for Leaflet and plugins fromclass-spotmap-public.phpwindow.L = Lafter import so future Leaflet plugins loaded as separate<script>tags still find the globalperformance.hintsto suppress bundle-size warningsWhy
WordPress caching/optimisation plugins were reordering or concatenating the previously separate Leaflet script tags and breaking the dependency chain. Bundling everything into one file eliminates that entire class of issues and simplifies the build.
Test plan
npm run buildcompletes without errorsleaflet-tilelayer-swiss) workswindow.Spotmap)