diff --git a/.changeset/curvy-pans-share.md b/.changeset/curvy-pans-share.md new file mode 100644 index 000000000000..df4ef548abf2 --- /dev/null +++ b/.changeset/curvy-pans-share.md @@ -0,0 +1,5 @@ +--- +'@astrojs/solid-js': patch +--- + +Adds the client entrypoint to `optimizeDeps.include` diff --git a/.changeset/smart-ties-hear.md b/.changeset/smart-ties-hear.md new file mode 100644 index 000000000000..0921ff671819 --- /dev/null +++ b/.changeset/smart-ties-hear.md @@ -0,0 +1,5 @@ +--- +'@astrojs/react': patch +--- + +Removes react-specific entrypoints in `optimizeDeps.include` and rely on `@vitejs/plugin-react` to add diff --git a/packages/integrations/react/src/index.ts b/packages/integrations/react/src/index.ts index b1effa27a044..46da29c7b9fd 100644 --- a/packages/integrations/react/src/index.ts +++ b/packages/integrations/react/src/index.ts @@ -54,20 +54,10 @@ function getViteConfiguration( ) { return { optimizeDeps: { - include: [ - reactConfig.client, - 'react', - 'react/jsx-runtime', - 'react/jsx-dev-runtime', - 'react-dom', - 'react-compiler-runtime', - ], + include: [reactConfig.client], exclude: [reactConfig.server], }, plugins: [react({ include, exclude, babel }), optionsPlugin(!!experimentalReactChildren)], - resolve: { - dedupe: ['react', 'react-dom', 'react-dom/server'], - }, ssr: { external: reactConfig.externals, noExternal: [ diff --git a/packages/integrations/solid/src/index.ts b/packages/integrations/solid/src/index.ts index 60680ff9c3de..f39dffed59b5 100644 --- a/packages/integrations/solid/src/index.ts +++ b/packages/integrations/solid/src/index.ts @@ -51,6 +51,7 @@ function getViteConfiguration( ) { const config: UserConfig = { optimizeDeps: { + include: ['@astrojs/solid-js/client.js'], exclude: ['@astrojs/solid-js/server.js'], }, plugins: [solid({ include, exclude, ssr: true })], diff --git a/packages/integrations/vue/src/index.ts b/packages/integrations/vue/src/index.ts index fc54a5f99a98..d9e42a6dd248 100644 --- a/packages/integrations/vue/src/index.ts +++ b/packages/integrations/vue/src/index.ts @@ -116,6 +116,8 @@ async function getViteConfiguration( const config: UserConfig = { optimizeDeps: { + // We add `vue` here as `@vitejs/plugin-vue` doesn't add it and we want to prevent + // re-optimization if the `vue` import is only encountered later. include: ['@astrojs/vue/client.js', 'vue'], exclude: ['@astrojs/vue/server.js', VIRTUAL_MODULE_ID], },