Fix require.cache error when loaded through a typescript file in Node 22.18+ (#18665)
Co-authored-by: Jordan Pittman <jordan@cryptica.me>
This commit is contained in:
parent
40f506f317
commit
ff52f8caf2
6 changed files with 33 additions and 29 deletions
2
.github/workflows/ci-stable.yml
vendored
2
.github/workflows/ci-stable.yml
vendored
|
|
@ -10,7 +10,7 @@ on:
|
|||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main, 3.3, 3.4]
|
||||
branches: [main, v3]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
|
|||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -7,7 +7,7 @@ on:
|
|||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main, 3.3, 3.4]
|
||||
branches: [main, v3]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
|
|||
4
.github/workflows/integration-tests.yml
vendored
4
.github/workflows/integration-tests.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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`<div class="font-normal"></div>`)
|
||||
})
|
||||
|
||||
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`<div class="bg-red-500"></div>`)
|
||||
})
|
||||
|
||||
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`<div class="font-normal"></div>`)
|
||||
})
|
||||
|
||||
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`<div class="bg-red-500"></div>`)
|
||||
})
|
||||
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue