FormidableLabs / FormidableLabs/webpack-stats-plugin

If webpack stats object gets large enough, JSON.stringify crashes

Open
#109 2 comments 0 reactions 0 assignees View on GitHub
unverified
Dominant language
JavaScript
Stars
357
Forks
26
PR merge metrics
No merged PRs in 30d

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

### Code Sandbox link

_No response_

### Bug report

The same bug that https://github.com/webpack/webpack-cli/pull/2190 fixes. The issue here is if webpack stats object is large enough you can no longer just call `JSON.stringify` on it, otherwise you get errors along the lines of `RangeError: Invalid string length`.

The fix here is to stream the JSON serialization rather than doing it at once. Fixing this might be tricky without making a breaking change to the plugin API since I'm not sure how it can be compatible with the current `opts.transform`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.