You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. We're using webpack's devtool: #cheap-module-inline-source-map option to add an inline base64 encoded source map to the bottom of our main app file. There's a decent amount of code there, so the sourcemap is a pretty gigantic string.
We ended up seeing the following error in the console:
RangeError: Maximum call stack size exceeded
at RegExp.exec (native)
I haven't been able to figure out why that is yet though (e.g. I don't think there's any catastrophic backtracking going on in the original version?) 😕
Just wondering if anyone else can shed some light on this? Cheers. (PS this change also works for the version currently published to npm).
This is still a problem with Angular 7 unit tests, which uses jasmine, karma, and webpack and creates very large bundles, on a small project, the bundle for vendor.js is over 17MB.
Just checking in to report that this issue still occurs with the new RegExp in very obscure scenarios. In the case I encountered, it was caused by this line in the emotion/react repo's createEmotionProps function that uses new Error().stack to update component labels while performing SSR builds with ts-node and next.js.
Interestingly, I was able to intercept the specific file data that caused the error by using local builds of ts-node and a local build of the fork of this repo @cspotcode/source-map-support that ts-node uses, and was not able to reproduce the RangeError with this regex independently with just Node.js.
However, overriding Error.prepareStackTrace to skip source-map-support's sourcemap transformation logic for stack traces demanded by createEmotionProps reliably resolves the error for me:
Based on this V8 bug I think RegExp.exec only throws RangeError: Maximum call stack size exceeded when backtracking often over large strings, so I think the current RegExp may still be too greedy for certain large inputs.
Activity
tanem commentedon Aug 20, 2015
Whoops, just realised this will probably be fixed by #86. Will check tomorrow.
SkeLLLa commentedon May 31, 2017
This issue is still present. Are there any plans for fixing this?
Here's more detailed stacktrace, if it helps:
gibbtek commentedon Jan 26, 2018
I can confirm I have the same issue. It happens randomly i.e. not every run.
The line that causes it for me is when executing the regex:
/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/)[ \t]*$)/mgtelb99 commentedon Jul 26, 2019
This is still a problem with Angular 7 unit tests, which uses jasmine, karma, and webpack and creates very large bundles, on a small project, the bundle for vendor.js is over 17MB.
darrengriffinhut42 commentedon Jul 29, 2019
I agree with @telb99. This i still an issue in Angular 8 and needs fixing. @LinusU, please resolve.
LinusU commentedon Jul 29, 2019
Happy to receive a PR for this 🙌
Fixed bug evanw#93
Tweak regex in retrieveSourceMapURL
LinusU commentedon Jul 31, 2019
This should be fixed in version
0.5.13, please report back if the issue persists!fix(webpack): externalize server source-map to prevent RangeError
fix(webpack): externalize server source-map to prevent RangeError
fix(webpack): externalize server source-map to prevent RangeError
fix(webpack): externalize server source-map to prevent RangeError
fix(webpack): externalize server source-map to prevent RangeError
leontastic commentedon Jun 7, 2023
Just checking in to report that this issue still occurs with the new RegExp in very obscure scenarios. In the case I encountered, it was caused by this line in the emotion/react repo's
createEmotionPropsfunction that usesnew Error().stackto update component labels while performing SSR builds with ts-node and next.js.Interestingly, I was able to intercept the specific file data that caused the error by using local builds of
ts-nodeand a local build of the fork of this repo@cspotcode/source-map-supportthatts-nodeuses, and was not able to reproduce theRangeErrorwith this regex independently with just Node.js.However, overriding
Error.prepareStackTraceto skipsource-map-support's sourcemap transformation logic for stack traces demanded bycreateEmotionPropsreliably resolves the error for me:Based on this V8 bug I think
RegExp.execonly throwsRangeError: Maximum call stack size exceededwhen backtracking often over large strings, so I think the currentRegExpmay still be too greedy for certain large inputs.