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.
Short version: Even though the documentation says otherwise, using
bundle
asconfig.cache
leaks memory and will probably throw an error in the future. Unfortunately, the Rollup documentation does not (yet) reflect this.Long version:
We've migrated a somewhat sizable library to a Rollup build and use this preprocessor for testing. When watching for changes, Node crashes after typically 2-3 file changes (
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
). While investigating the problem, I found that not passing a cache fixes the problem (but obviously slows down the build a lot).I then found this issue, for which a fix was released just days ago. I upgraded to Rollup v0.66.5, but the problem remained. Re-reading the issue, passing a previously generated
bundle
as theconfig.cache
option of a subsequent bundle is apparently bad. It may work, but it's not the intended usage and introduces a memory leak. The documentation will hopefully be adapted and passing a bundle may throw in the future. Instead,bundle.cache
should be passed inconfig.cache
. Doing so solves our crashes and works as intended in terms of caching.