New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack --profile --json
"RangeError: Invalid string length" when outputting _huge_ JSON file
#4629
Comments
This fixes webpack#4629
This fixes webpack#4629 JSON.stringify can fail with `RangeError: Invalid string length` when it runs out of memory. See nodejs/node-v0.x-archivei#14170. With this fix, I was able to write out the profile JSON without errors.
With the fix from #4630, I was able to output the JSON. |
Any chance of having this included in the next release? Manual patching webpack.js is definitely not the best approach... |
v8 supports larger strings soon |
So using Node v10, I managed to make one of these stats files. I had to give Node 16GB of ram and the resultant file was 870MB! There must be a better way than this to analyse webpack bundles. |
I'm still seeing this even after upgrading to node 10. The exact version I'm running is |
I have a large project with many entry points and I also get this error after upgrading to NodeJS 10.15.3. I was able to modify In my case, that fork successfully generated a JSON file containing In short, I don't think that relying on larger string sizes in NodeJS 10 is an appropriate way to dismiss this issue. There are real projects that have Would a change to write the stats object as JSON using a stream be a welcome change? |
We have a 1.6GB stats file (with @cjlarose's nice streaming addition to webpack-cli) however all the analysis tools fail to load a stat file that big. I.e. getting the stats file is only half the battle - analysing something that big is the next challenge. |
Having the same issue, node v14.15.1, webpack 4.43.0, webpack-cli 3.3.5:
|
fixed, will be available in the next release of webpack-cli |
I think this is the PR that fixes the issue webpack/webpack-cli#2190 |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When running webpack with
--profile --json
flags, and the JSON data to be output is rather big, it fails with this error:If the current behavior is a bug, please provide the steps to reproduce.
Well, I guess you need a project with enough entry points, and a complicated enough module graph that the size of the profile is quite large. I will try to create a reproducible repo, but actually this is demonstrable with node & no dependencies:
nodejs/node-v0.x-archive#14170
What is the expected behavior?
The JSON should be output to
stdout
If this is a feature request, what is motivation or use case for changing the behavior?
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
The text was updated successfully, but these errors were encountered: