From 1069536cb481a8c1c7835d75b0ebeae840fe9bd0 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Thu, 28 Apr 2022 15:09:46 -0400 Subject: [PATCH] fix: disable old workaround by mutating `optimizeDeps.include` --- packages/plugin-react/src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index c31a109b0bd7cd..a369750733eb9e 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -361,9 +361,12 @@ export default function viteReact(opts: Options = {}): PluginOption[] { reactPackageRoot, 'cjs/react-jsx-runtime.production.min.js' ) - // These must be optimized since they are CommonJS. optimizeDeps.include = [ - ...(optimizeDeps.include || []), + ...(optimizeDeps.include || []).filter( + // Disable old workaround so unnecessary work is avoided. + (id) => id !== prodRuntimeId && id !== devRuntimeId + ), + // These must be optimized since they are CommonJS. prodEntry, devEntry ]