From 75c278b54ec2207fb661dc2a04ea373e485148a9 Mon Sep 17 00:00:00 2001 From: Remus Mate Date: Sat, 3 Feb 2024 21:07:25 +1100 Subject: [PATCH] Don't pass Remix Vite plugin to the vite-node compiler --- .changeset/vite-plugin-remix.md | 7 +++++++ packages/vite-plugin/src/index.ts | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/vite-plugin-remix.md diff --git a/.changeset/vite-plugin-remix.md b/.changeset/vite-plugin-remix.md new file mode 100644 index 00000000..b6401418 --- /dev/null +++ b/.changeset/vite-plugin-remix.md @@ -0,0 +1,7 @@ +--- +'@vanilla-extract/vite-plugin': patch +--- + +Don't pass Remix Vite plugin to the vite-node compiler + +Remix throws an error if it's loaded without a config file, like we do when we initialise the vite-node compiler. diff --git a/packages/vite-plugin/src/index.ts b/packages/vite-plugin/src/index.ts index d739ea99..55557b3f 100644 --- a/packages/vite-plugin/src/index.ts +++ b/packages/vite-plugin/src/index.ts @@ -125,11 +125,13 @@ export function vanillaExtractPlugin({ plugin !== null && 'name' in plugin && // Prevent an infinite loop where the compiler creates a new instance of the plugin, - // which creates a new compiler, which creates a new instance of the plugin, etc. + // which creates a new compiler, which creates a new instance of the plugin, etc. plugin.name !== 'vanilla-extract' && // Skip Vitest plugins plugin.name !== 'vitest' && - !plugin.name.startsWith('vitest:'), + !plugin.name.startsWith('vitest:') && + // Skip Remix because it throws an error if it's not loaded with a config file + plugin.name !== 'remix' ), }); }