Skip to content

Commit ce738ba

Browse files
authored
vite: Ensure compiler is re-used between builds (#1399)
1 parent 39ea179 commit ce738ba

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/odd-crews-itch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/vite-plugin': patch
3+
---
4+
5+
Ensure the compiler instance is re-used between builds

packages/vite-plugin/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ export function vanillaExtractPlugin({
117117
packageName = getPackageInfo(config.root).name;
118118
},
119119
async buildStart() {
120-
if (mode !== 'transform') {
120+
// Ensure we re-use the compiler instance between builds, e.g. in watch mode
121+
if (mode !== 'transform' && !compiler) {
121122
const { loadConfigFromFile } = await vitePromise;
122123
const configFile = await loadConfigFromFile(
123124
{

0 commit comments

Comments
 (0)