From e8b121d04afed56b83f98032f6e9c0243806925b Mon Sep 17 00:00:00 2001 From: bluwy Date: Fri, 17 Jan 2025 00:55:35 +0800 Subject: [PATCH] Remove react integration ssr.external config --- .changeset/many-pianos-develop.md | 5 +++++ packages/integrations/react/src/index.ts | 1 - packages/integrations/react/src/version.ts | 3 --- 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 .changeset/many-pianos-develop.md diff --git a/.changeset/many-pianos-develop.md b/.changeset/many-pianos-develop.md new file mode 100644 index 000000000000..6a8716e5f048 --- /dev/null +++ b/.changeset/many-pianos-develop.md @@ -0,0 +1,5 @@ +--- +'@astrojs/react': patch +--- + +Removes hardcoded `ssr.external: ['react-dom/server', 'react-dom/client']` config that causes issues with adapters that bundle all dependencies (e.g. Cloudflare). These externals should already be inferred by default by Vite when deploying to a server environment. diff --git a/packages/integrations/react/src/index.ts b/packages/integrations/react/src/index.ts index 1569a7c70b6c..1d88b09e1ff1 100644 --- a/packages/integrations/react/src/index.ts +++ b/packages/integrations/react/src/index.ts @@ -59,7 +59,6 @@ function getViteConfiguration( }, plugins: [react({ include, exclude, babel }), optionsPlugin(!!experimentalReactChildren)], ssr: { - external: reactConfig.externals, noExternal: [ // These are all needed to get mui to work. '@mui/material', diff --git a/packages/integrations/react/src/version.ts b/packages/integrations/react/src/version.ts index dc3a7a85aecf..29118f13b77c 100644 --- a/packages/integrations/react/src/version.ts +++ b/packages/integrations/react/src/version.ts @@ -19,16 +19,13 @@ export const versionsConfig = { 17: { server: '@astrojs/react/server-v17.js', client: '@astrojs/react/client-v17.js', - externals: ['react-dom/server.js', 'react-dom/client.js'], }, 18: { server: '@astrojs/react/server.js', client: '@astrojs/react/client.js', - externals: ['react-dom/server', 'react-dom/client'], }, 19: { server: '@astrojs/react/server.js', client: '@astrojs/react/client.js', - externals: ['react-dom/server', 'react-dom/client'], }, };