Skip to content

Commit

Permalink
Fix vite watch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis committed Apr 29, 2024
1 parent 1381e54 commit e8f4e13
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gentle-ligers-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@vanilla-extract/vite-plugin': patch
---

Fixes a bug that was causing output CSS files to not update during watch mode
9 changes: 8 additions & 1 deletion packages/vite-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,14 @@ export function vanillaExtractPlugin({
}
},
buildEnd() {
compiler?.close();
// When using the rollup watcher, we don't want to close the compiler after every build.
// Instead, we close it when the watcher is closed via the closeWatcher hook.
if (!config.build.watch) {
compiler?.close();
}
},
closeWatcher() {
return compiler?.close();
},
async transform(code, id) {
const [validId] = id.split('?');
Expand Down

0 comments on commit e8f4e13

Please sign in to comment.