Drop the dangling source map reference from underscore.js (#38865) - #41093
Open
lbajsarowicz wants to merge 1 commit into
Open
Drop the dangling source map reference from underscore.js (#38865)#41093lbajsarowicz wants to merge 1 commit into
lbajsarowicz wants to merge 1 commit into
Conversation
lib/web/underscore.js is underscore's UMD build vendored under a different
file name, and it kept the trailing sourceMappingURL comment pointing at
underscore-umd.js.map. That map is not shipped, so every browser with
developer tools open requests it and Magento cannot resolve it:
main.ERROR: Unable to resolve the source file for
'adminhtml/Magento/backend/en_US/underscore-umd.js.map'
Remove the comment, since there is no map to point at. Shipping the upstream
map instead would not help: it describes underscore-umd.js and references
sources that are not vendored either.
Fixes magento#38865
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Contributor
Author
|
@magento run all tests |
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.
Description (*)
lib/web/underscore.jsis underscore's UMD distribution (underscore-umd.js) vendored into Magento under a different file name. The copy kept the build's trailing source map comment:The map itself is not vendored — there is no
.mapfile anywhere underlib/web. So any browser with developer tools open follows that comment and requestsunderscore-umd.js.mapnext to the deployedunderscore.js, which Magento cannot resolve.Reproduced on
2.4-developin developer mode:The message comes from
Magento\Framework\View\Asset\File::getSourceFile(), reached throughMagento\Framework\App\StaticResourcewhen the map is requested. Because underscore is loaded on effectively every admin page, the log fills up with this entry during ordinary development.This PR removes the dangling comment. Vendoring the upstream map instead was considered and rejected: it describes
underscore-umd.jsrather than the file Magento actually ships, and itssourcespoint atunderscore-esm.js, which is not vendored either — developer tools would then fail on the sources instead of the map.After the change the deployed asset no longer advertises a map, so the request is never made and the log entry disappears.
Note for reviewers: 27 other vendored bundles under
lib/web(hugerte skins, uppy, chartjs, less.min.js, vimeo player) carry the same kind of danglingsourceMappingURL. This PR deliberately stays with the reported file — those are separate third-party bundles and touching them is better done alongside their next library update.Related Pull Requests
None.
Fixed Issues (if relevant)
Manual testing scenarios (*)
.../en_US/underscore-umd.js.map, andvar/log/system.log/var/log/debug.logrecordUnable to resolve the source file for '.../en_US/underscore-umd.js.map'.After: no map request is made and no such entry is logged.
underscore.jsloads and_.VERSIONreports1.13.7.Questions or comments
The change removes one comment line from a vendored asset; no PHP is touched, so there is no unit or integration test in scope, and
lib/web/underscore.jsis not part of the ESLint whitelist (dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/magento.txt) since it is third-party code. Verification was done against a running instance as described above, plus a check that the library still parses and evaluates after the edit.Contribution checklist (*)