diff --git a/CHANGELOG.md b/CHANGELOG.md index f215d9c28ac1..4c4d88d42187 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Ignore PostCSS nodes returned by `addVariant` ([#8608](https://github.com/tailwindlabs/tailwindcss/pull/8608)) - Fix missing spaces around arithmetic operators ([#8615](https://github.com/tailwindlabs/tailwindcss/pull/8615)) - Detect alpha value in CSS `theme()` function when using quotes ([#8625](https://github.com/tailwindlabs/tailwindcss/pull/8625)) +- Fix "Maximum call stack size exceeded" bug ([#8636](https://github.com/tailwindlabs/tailwindcss/pull/8636)) ## [3.1.2] - 2022-06-10 diff --git a/src/lib/defaultExtractor.js b/src/lib/defaultExtractor.js index 9106bd59371a..4c28d007a047 100644 --- a/src/lib/defaultExtractor.js +++ b/src/lib/defaultExtractor.js @@ -12,7 +12,7 @@ export function defaultExtractor(context) { let results = [] for (let pattern of patterns) { - results.push(...(content.match(pattern) ?? [])) + results = [...results, ...(content.match(pattern) ?? [])] } return results.filter((v) => v !== undefined).map(clipAtBalancedParens) diff --git a/tests/default-extractor.test.js b/tests/default-extractor.test.js index d23dfd9cc3ad..e0a39431a0bc 100644 --- a/tests/default-extractor.test.js +++ b/tests/default-extractor.test.js @@ -476,3 +476,9 @@ test('multi-word + arbitrary values + quotes', async () => { expect(extractions).toContain(`grid-cols-['repeat(2)']`) }) + +test('a lot of data', () => { + let extractions = defaultExtractor('underline '.repeat(2 ** 17)) + + expect(extractions).toContain(`underline`) +})