Skip to content

Commit c7642fb

Browse files
authored
Remove custom optimizeDeps.include in react integration (#12923)
1 parent cca3bc9 commit c7642fb

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

.changeset/curvy-pans-share.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/solid-js': patch
3+
---
4+
5+
Adds the client entrypoint to `optimizeDeps.include`

.changeset/smart-ties-hear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/react': patch
3+
---
4+
5+
Removes react-specific entrypoints in `optimizeDeps.include` and rely on `@vitejs/plugin-react` to add

packages/integrations/react/src/index.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,10 @@ function getViteConfiguration(
5454
) {
5555
return {
5656
optimizeDeps: {
57-
include: [
58-
reactConfig.client,
59-
'react',
60-
'react/jsx-runtime',
61-
'react/jsx-dev-runtime',
62-
'react-dom',
63-
'react-compiler-runtime',
64-
],
57+
include: [reactConfig.client],
6558
exclude: [reactConfig.server],
6659
},
6760
plugins: [react({ include, exclude, babel }), optionsPlugin(!!experimentalReactChildren)],
68-
resolve: {
69-
dedupe: ['react', 'react-dom', 'react-dom/server'],
70-
},
7161
ssr: {
7262
external: reactConfig.externals,
7363
noExternal: [

packages/integrations/solid/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function getViteConfiguration(
5151
) {
5252
const config: UserConfig = {
5353
optimizeDeps: {
54+
include: ['@astrojs/solid-js/client.js'],
5455
exclude: ['@astrojs/solid-js/server.js'],
5556
},
5657
plugins: [solid({ include, exclude, ssr: true })],

packages/integrations/vue/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ async function getViteConfiguration(
116116

117117
const config: UserConfig = {
118118
optimizeDeps: {
119+
// We add `vue` here as `@vitejs/plugin-vue` doesn't add it and we want to prevent
120+
// re-optimization if the `vue` import is only encountered later.
119121
include: ['@astrojs/vue/client.js', 'vue'],
120122
exclude: ['@astrojs/vue/server.js', VIRTUAL_MODULE_ID],
121123
},

0 commit comments

Comments
 (0)