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
Stream JSON output (--json) #4630
Conversation
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think using JSONStream will solve this issue. JSONStream uses JSON.stringify(item)
internally. This does work in your example because it uses JSON.stringify(obj)
instead of JSON.stringify(obj, null, 2)
. This generates a much smaller string.
Maybe just change to JSON.stringify(obj)
which increases the limit. Or find a json stringifier which really stringifies in chunks.
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
|
We can try |
I applied the change to webpack 1.13.0, node version v4.4.7, npm version 2.15.8 But I got this error :( stream.js:74 RangeError: Invalid string length |
This fixes #4629
What kind of change does this PR introduce?
bugfix
Did you add tests for your changes?
No. I will have a look and see if I can find where to add appropriate tests.
If relevant, link to documentation update:
Summary
This fixes an issue in #4629 where I reported that I was unable to write out profile JSON.
Does this PR introduce a breaking change?
I don't believe so, no.
Other information