diff --git a/.github/workflows/ci-stable.yml b/.github/workflows/ci-stable.yml index 394bd6dda567..61ae38e6f415 100644 --- a/.github/workflows/ci-stable.yml +++ b/.github/workflows/ci-stable.yml @@ -10,7 +10,7 @@ on: push: branches: [main] pull_request: - branches: [main, 3.3, 3.4] + branches: [main, v3] permissions: contents: read diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5c0135fb3f5..71649f4bb099 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: push: branches: [main] pull_request: - branches: [main, 3.3, 3.4] + branches: [main, v3] permissions: contents: read diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index f0967175cc26..ff5a68df1740 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -2,9 +2,9 @@ name: Integration Tests on: push: - branches: [main, 3.3, 3.4] + branches: [main, v3] pull_request: - branches: [main, 3.3, 3.4] + branches: [main, v3] permissions: contents: read diff --git a/CHANGELOG.md b/CHANGELOG.md index ffcdd5bbd9f5..bd4b0197ddd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Improve support for raw `supports-[…]` queries in arbitrary values ([#13605](https://github.com/tailwindlabs/tailwindcss/pull/13605)) +- Fix `require.cache` error when loaded through a TypeScript file in Node 22.18+ ([#18665](https://github.com/tailwindlabs/tailwindcss/pull/18665)) ## [3.4.17] - 2024-12-17 diff --git a/integrations/parcel/tests/integration.test.js b/integrations/parcel/tests/integration.test.js index beaf5e70d7dc..f0ae14a26354 100644 --- a/integrations/parcel/tests/integration.test.js +++ b/integrations/parcel/tests/integration.test.js @@ -24,7 +24,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .font-bold { font-weight: 700; } @@ -71,7 +71,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .bg-primary { --tw-bg-opacity: 1; background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1)); @@ -121,7 +121,7 @@ describe('static build', () => { env: { NODE_ENV: 'production' }, }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .bg-primary { --tw-bg-opacity: 1; background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1)); @@ -142,19 +142,19 @@ describe('watcher', () => { let runningProcess = $('parcel watch ./src/index.html --no-cache') - await waitForOutputFileCreation(/index\.\w+\.css$/) + await waitForOutputFileCreation(/parcel\.\w+\.css$/) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .font-bold { font-weight: 700; } `) - await waitForOutputFileChange(/index\.\w+\.css$/, async () => { + await waitForOutputFileChange(/parcel\.\w+\.css$/, async () => { await appendToInputFile('index.html', html`
`) }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .font-bold { font-weight: 700; } @@ -163,11 +163,11 @@ describe('watcher', () => { } `) - await waitForOutputFileChange(/index\.\w+\.css$/, async () => { + await waitForOutputFileChange(/parcel\.\w+\.css$/, async () => { await appendToInputFile('index.html', html`
`) }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .bg-red-500 { --tw-bg-opacity: 1; background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1)); @@ -190,19 +190,19 @@ describe('watcher', () => { let runningProcess = $('parcel watch ./src/index.html --no-cache') - await waitForOutputFileCreation(/index\.\w+\.css$/) + await waitForOutputFileCreation(/parcel\.\w+\.css$/) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .font-bold { font-weight: 700; } `) - await waitForOutputFileChange(/index\.\w+\.css$/, async () => { + await waitForOutputFileChange(/parcel\.\w+\.css$/, async () => { await appendToInputFile('glob/index.html', html`
`) }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .font-bold { font-weight: 700; } @@ -211,11 +211,11 @@ describe('watcher', () => { } `) - await waitForOutputFileChange(/index\.\w+\.css$/, async () => { + await waitForOutputFileChange(/parcel\.\w+\.css$/, async () => { await appendToInputFile('glob/index.html', html`
`) }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .bg-red-500 { --tw-bg-opacity: 1; background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1)); @@ -242,9 +242,9 @@ describe('watcher', () => { let runningProcess = $('parcel watch ./src/index.html --no-cache') - await waitForOutputFileCreation(/index\.\w+\.css$/) + await waitForOutputFileCreation(/parcel\.\w+\.css$/) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .font-bold { font-weight: 700; } @@ -255,7 +255,7 @@ describe('watcher', () => { } `) - await waitForOutputFileChange(/index\.\w+\.css$/, async () => { + await waitForOutputFileChange(/parcel\.\w+\.css$/, async () => { await writeInputFile( '../tailwind.config.js', javascript` @@ -280,7 +280,7 @@ describe('watcher', () => { ) }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .font-bold { font-weight: bold; } @@ -305,15 +305,15 @@ describe('watcher', () => { let runningProcess = $('parcel watch ./src/index.html --no-cache') - await waitForOutputFileCreation(/index\.\w+\.css$/) + await waitForOutputFileCreation(/parcel\.\w+\.css$/) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .font-bold { font-weight: 700; } `) - await waitForOutputFileChange(/index\.\w+\.css$/, async () => { + await waitForOutputFileChange(/parcel\.\w+\.css$/, async () => { await writeInputFile( 'index.css', css` @@ -330,7 +330,7 @@ describe('watcher', () => { ) }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` /* prettier-ignore */ .btn { border-radius: .25rem; @@ -341,7 +341,7 @@ describe('watcher', () => { } `) - await waitForOutputFileChange(/index\.\w+\.css$/, async () => { + await waitForOutputFileChange(/parcel\.\w+\.css$/, async () => { await writeInputFile( 'index.css', css` @@ -358,7 +358,7 @@ describe('watcher', () => { ) }) - expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss(css` + expect(await readOutputFile(/parcel\.\w+\.css$/)).toIncludeCss(css` .btn { --tw-bg-opacity: 1; background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1)); diff --git a/src/lib/setupTrackingContext.js b/src/lib/setupTrackingContext.js index 70e7cb684139..93df47200822 100644 --- a/src/lib/setupTrackingContext.js +++ b/src/lib/setupTrackingContext.js @@ -54,6 +54,9 @@ function getTailwindConfig(configOrPath) { // It has changed (based on timestamps), or first run for (let file of newDeps) { + // When loaded transitively through a TypeScript file `require.cache` + // may be undefined. Happens in Node 22.18+. + if (!require.cache) continue delete require.cache[file] } let newConfig = validateConfig(resolveConfig(loadConfig(userConfigPath)))