mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Fixes #16732 If we can not get the mtime from a file, chances are that the resource is a virtual module. This is perfectly legit and we can fall back to what we did before the changes in `4.0.8` (which is to rebuild the root every time a change contains a dependency like that). ## Test plan Added a test to mimic the setup from the repor in #16732. Also ensured the repro now passes: <img width="1278" alt="Screenshot 2025-02-24 at 17 29 38" src="https://github.com/user-attachments/assets/d111273d-579f-44c2-82f5-aa32d6a1879a" /> Note that importing virtual modules directly in CSS does not work as the resolver we use does not resolve against the Vite runtime it seems. This is unrelated to the regression added in `4.0.8` though and something to look into in the future.
88 lines
2.3 KiB
TypeScript
88 lines
2.3 KiB
TypeScript
import { candidate, css, fetchStyles, html, retryAssertion, test, ts, txt } from '../utils'
|
||
|
||
const WORKSPACE = {
|
||
'package.json': txt`
|
||
{
|
||
"type": "module",
|
||
"dependencies": {
|
||
"@tailwindcss/vite": "workspace:^",
|
||
"tailwindcss": "workspace:^"
|
||
},
|
||
"devDependencies": {
|
||
"vite": "^5.3.5"
|
||
}
|
||
}
|
||
`,
|
||
'vite.config.ts': ts`
|
||
import tailwindcss from '@tailwindcss/vite'
|
||
import { defineConfig } from 'vite'
|
||
import { fileURLToPath } from 'node:url'
|
||
|
||
export default defineConfig({
|
||
build: { cssMinify: false },
|
||
plugins: [tailwindcss(), virtualModule()],
|
||
})
|
||
|
||
function virtualModule() {
|
||
const virtualModuleId = 'virtual:my-module.css'
|
||
const resolvedVirtualModuleId = ' |