mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Closes #17512 One of the changes of the Oxide API in 4.1 is that it now emits the input CSS file itself as a dependency. This was fine in most of our testing but it turns out that certain integrations (in this case a Qwik project) don't like this and will silently crash with no CSS file being added anymore. This PR fixes this by making sure we don't add the input file as a dependency on itself and also adds an integration test to ensure this won't regress again. ## Test plan - Tested with the repro provided in #17512 - Added a minimal integration test based on that reproduction that I also validated will _fail_, if the fix is reverted.
101 lines
2.7 KiB
TypeScript
101 lines
2.7 KiB
TypeScript
import { candidate, css, fetchStyles, json, retryAssertion, test, ts } from '../utils'
|
|
|
|
test(
|
|
'dev mode',
|
|
{
|
|
fs: {
|
|
'package.json': json`
|
|
{
|
|
"type": "module",
|
|
"dependencies": {
|
|
"@builder.io/qwik": "^1",
|
|
"@builder.io/qwik-city": "^1",
|
|
"vite": "^5",
|
|
"@tailwindcss/vite": "workspace:^",
|
|
"tailwindcss": "workspace:^"
|
|
}
|
|
}
|
|
`,
|
|
'vite.config.ts': ts`
|
|
import { defineConfig } from 'vite'
|
|
import { qwikVite } from '@builder.io/qwik/optimizer'
|
|
import { qwikCity } from '@builder.io/qwik-city/vite'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
export default defineConfig(() => {
|
|
return {
|
|
plugins: [tailwindcss(), qwikCity(), qwikVite()],
|
|
}
|
|
})
|
|
`,
|
|
'src/root.tsx': ts`
|
|
import { component$ } from '@builder.io/qwik'
|
|
import { QwikCityProvider, RouterOutlet } from '@builder.io/qwik-city'
|
|
|
|
import './global.css'
|
|
|
|
export default component$(() => {
|
|
return (
|
|
<QwikCityProvider>
|
|
<head></head>
|
|
<body>
|
|
<RouterOutlet />
|
|
</body>
|
|
</QwikCityProvider>
|
|
)
|
|
})
|
|
`,
|
|
'src/global.css': css`@import 'tailwindcss/utilities.css';`,
|
|
'src/entry.ssr.tsx': ts`
|
|
import { renderToStream, type RenderToStreamOptions } from '@builder.io/qwik/server'
|
|
import Root from './root'
|
|
|
|
export default function (opts: RenderToStreamOptions) {
|
|
return renderToStream(<Root />, opts)
|
|
}
|
|
`,
|
|
'src/routes/index.tsx': ts`
|
|
import { component$ } from '@builder.io/qwik'
|
|
|
|
export default component$(() => {
|
|
return <h1 class="underline">Hello World!</h1>
|
|
})
|
|
`,
|
|
},
|
|
},
|
|
async ({ fs, spawn, expect }) => {
|
|
let process = await spawn('pnpm vite --mode ssr')
|
|
await process.onStdout((m) => m.includes('ready in'))
|
|
|
|
let url = ''
|
|
await process.onStdout((m) => {
|
|
console.log(m)
|
|
let match = /Local:\s*(http.*)\//.exec(m)
|
|
if (match) url = match[1]
|
|
return Boolean(url)
|
|
})
|
|
|
|
await retryAssertion(async () => {
|
|
let css = await fetchStyles(url)
|
|
expect(css).toContain(candidate`underline`)
|
|
})
|
|
|
|
await retryAssertion(async () => {
|
|
await fs.write(
|
|
'src/routes/index.tsx',
|
|
ts`
|
|
import { component$ } from '@builder.io/qwik'
|
|
|
|
export default component$(() => {
|
|
return <h1 class="underline flex">Hello World!</h1>
|
|
})
|
|
`,
|
|
)
|
|
|
|
let css = await fetchStyles(url)
|
|
expect(css).toContain(candidate`underline`)
|
|
expect(css).toContain(candidate`flex`)
|
|
})
|
|
},
|
|
)
|