Skip to content

Commit

Permalink
vite: Ensure compiler is re-used between builds (#1399)
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis committed Apr 29, 2024
1 parent 39ea179 commit ce738ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/odd-crews-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@vanilla-extract/vite-plugin': patch
---

Ensure the compiler instance is re-used between builds
3 changes: 2 additions & 1 deletion packages/vite-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ export function vanillaExtractPlugin({
packageName = getPackageInfo(config.root).name;
},
async buildStart() {
if (mode !== 'transform') {
// Ensure we re-use the compiler instance between builds, e.g. in watch mode
if (mode !== 'transform' && !compiler) {
const { loadConfigFromFile } = await vitePromise;
const configFile = await loadConfigFromFile(
{
Expand Down

0 comments on commit ce738ba

Please sign in to comment.