From 1fd348a91036a1370e61de85199ca6f78533ed8e Mon Sep 17 00:00:00 2001 From: Chris Feijoo Date: Thu, 24 Oct 2024 18:23:56 -0400 Subject: [PATCH] fix(vite-plugin): Omit React-Router v7 plugin for DevServer (#1492) Co-authored-by: Adam Skoufis --- .changeset/vite-plugin-react-router.md | 5 +++++ packages/vite-plugin/src/index.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/vite-plugin-react-router.md diff --git a/.changeset/vite-plugin-react-router.md b/.changeset/vite-plugin-react-router.md new file mode 100644 index 000000000..0a7932ca5 --- /dev/null +++ b/.changeset/vite-plugin-react-router.md @@ -0,0 +1,5 @@ +--- +'@vanilla-extract/vite-plugin': patch +--- + +Filter out `react-router` Vite plugin when creating the `vite-node` compiler diff --git a/packages/vite-plugin/src/index.ts b/packages/vite-plugin/src/index.ts index ec3e193eb..0d41bcb29 100644 --- a/packages/vite-plugin/src/index.ts +++ b/packages/vite-plugin/src/index.ts @@ -40,7 +40,9 @@ const removeIncompatiblePlugins = (plugin: PluginOption) => // 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'); + !plugin.name.startsWith('remix') && + // As React-Router plugin works the same as Remix plugin, also ignore it. + !plugin.name.startsWith('react-router'); interface Options { identifiers?: IdentifierOption;