Skip to content

Commit

Permalink
fix: CSS dependencies are tracked incorrectly when base is set
Browse files Browse the repository at this point in the history
The change in vitejs#4267 caused all CSS
dependencies of files that are not CSS (Tailwind CSS JIT deps) to be
tracked with the `base` prefix in the module graph.

URLs in the module graph are normalized and are never prefixed with base
and as a result changes to those files were not causing the CSS module
to be invalidated.

See tailwindlabs/tailwindcss#4978 (comment)
  • Loading branch information
ElMassimo committed Aug 12, 2021
1 parent ed16488 commit 23b4e88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/plugins/css.ts
Expand Up @@ -208,7 +208,9 @@ export function cssPlugin(config: ResolvedConfig): Plugin {
isCSSRequest(file)
? moduleGraph.createFileOnlyEntry(file)
: await moduleGraph.ensureEntryFromUrl(
await fileToUrl(file, config, this)
(
await fileToUrl(file, config, this)
).replace(config.base, '/')
)
)
}
Expand Down

0 comments on commit 23b4e88

Please sign in to comment.