From 05ef2f01bcf7cdf21ac0092ce0b23d8accded58d Mon Sep 17 00:00:00 2001 From: Adam Skoufis Date: Thu, 28 Mar 2024 14:56:28 +1100 Subject: [PATCH] Filter all Remix vite plugins before passing to `vite-node` (#1369) --- .changeset/hip-zebras-hear.md | 5 +++++ packages/vite-plugin/src/index.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/hip-zebras-hear.md diff --git a/.changeset/hip-zebras-hear.md b/.changeset/hip-zebras-hear.md new file mode 100644 index 000000000..87d736ec6 --- /dev/null +++ b/.changeset/hip-zebras-hear.md @@ -0,0 +1,5 @@ +--- +'@vanilla-extract/vite-plugin': patch +--- + +Fixes a bug where an internal Remix plugin would throw an error inside the `vite-node` compiler diff --git a/packages/vite-plugin/src/index.ts b/packages/vite-plugin/src/index.ts index 2ec779d58..1dd2cb995 100644 --- a/packages/vite-plugin/src/index.ts +++ b/packages/vite-plugin/src/index.ts @@ -146,7 +146,10 @@ export function vanillaExtractPlugin({ // If it _is_ loaded with a config file, it will create an infinite loop because it // also has a child compiler which uses the same mechanism to load the config file. // https://github.com/remix-run/remix/pull/7990#issuecomment-1809356626 - plugin.name !== 'remix', + // Additionally, some internal Remix plugins rely on a `ctx` object to be initialized by + // the main Remix plugin, and may not function correctly without it. To address this, we + // filter out all Remix-related plugins. + !plugin.name.startsWith('remix'), ), }, });