fix: skip merging large input sourcemaps#10890
Merged
nicolo-ribaudo merged 1 commit intobabel:masterfrom Dec 19, 2019
Merged
Conversation
Member
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
Note that we already do something similar in @babel/generator: if the input is >500K (I think) we disable the formatting.
| // when `lastComment` is non-null, EXTERNAL_SOURCEMAP_REGEX must have matches | ||
| const match: [string, string] = (EXTERNAL_SOURCEMAP_REGEX.exec( | ||
| lastComment, | ||
| ): any); |
Member
There was a problem hiding this comment.
Is this guaranteed to never return null?
Contributor
Author
There was a problem hiding this comment.
Yes because the capturing group
([^\s'"`]+)
has a + quantifier, if the whole regex passed, the capturing group must not be null.
Contributor
Author
|
@nicolo-ribaudo Correct. I have tested on |
nicolo-ribaudo
approved these changes
Dec 18, 2019
existentialism
approved these changes
Dec 19, 2019
This was referenced Feb 22, 2020
This was referenced Mar 7, 2020
This was referenced Mar 14, 2020
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR addresses #10875 where a large input source map is consumed and causing OOM error. It is not an ideal fix but still preserve basic support for practical size input source map.
Note that #10885 misidentified the memory bottleneck. But I preserve the change here since we need to detect the source map file size.
Ideally the mergeSourceMap in babel generator should operate in a streaming mode. But this does not fit in a patch release.
I don't consider it as a regression since in 7.6.4 the
inputSourceMapis not working properly on external sourcemaps.@artisb45 @midgethoen Though the URL does not change, here is a new fix. You can download it and overwrite
node_modules/@babel/core/lib/transformation/normalize-file.js.