Remove react integration ssr.external config (#12996)

This commit is contained in:
Bjorn Lu 2025-01-17 21:50:09 +08:00 committed by GitHub
parent 627aec3f04
commit 80c6801b4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View file

@ -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.

View file

@ -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',

View file

@ -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'],
},
};