Repository navigation
Conversation
getAppendScripts built the inline source map with a filter that accepts every module, while the bundle code and the external source map apply `serializer.processModuleFilter`. Filtered modules still took up lines in the inline map, so every mapping after them was shifted.
This branch has not been deployed
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
Projects that set
serializer.processModuleFilter(for example to build a split bundle without the polyfills and modules already shipped in a base bundle) and use an inline source map (metro build --source-maporrunBuildwithsourceMap: trueand nosourceMapUrl, or a dev server request with?inlineSourceMap=true) get a map in which every module after a filtered one is shifted down by the filtered module's lines, so stack traces and debugger locations point to the wrong file and line.baseJSBundledrops filtered modules from the bundle code (processModules(..., {filter: options.processModuleFilter})), butgetAppendScriptsbuilt the inline map withprocessModuleFilter: () => true, so the filtered modules still took up lines in it. The external.mapalready usesconfig.serializer.processModuleFilterinServer, so only the inline map disagreed with the code it describes.This passes
processModuleFilterfrom the serializer options togetAppendScriptsand uses it for the inline map, the same way as for the external map.Changelog: [Fix] Apply
serializer.processModuleFilterto inline source maps, so their mappings match the filtered bundleTest plan
Added a test to
baseJSBundle-test.jsthat filters out the polyfill and checks the sections of the inline source map. Before this changefooandbarwere mapped to lines 1 and 2, although the filtered bundle starts with them on lines 0 and 1, so the test failed. With the change it passes.eslintandprettier --checkpass on the changed files.