Fix "Maximum call stack size exceeded" bug #8636
Merged
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.
For performance reasons we already read the content line by line, this allows us to cache individual lines if we already saw them. This also allows us to do the necessary work on relatively "small" content chunks because not a lot of developers use very long lines in the source files.
However...
Some people either misconfigure the
content
paths to include everything (even node_modules) or in a more realistic scenario link to a 3rd party dependency that uses Tailwind inside the node_modules folder. Those files are typically minified, all on one line. The stack size issue occurs when we try to push a lot of matches into an array. We usedresult.push(...x)
which is limited by the length ofx
because functions have a maximum amount of parameters they can receive.Thanks to @nam-tran-tego for the wonderful reproduction and fix for this!
Fixes: #8582