Skip to content

Commit

Permalink
Remove custom optimizeDeps.include in react integration (#12923)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Jan 13, 2025
1 parent cca3bc9 commit c7642fb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-pans-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/solid-js': patch
---

Adds the client entrypoint to `optimizeDeps.include`
5 changes: 5 additions & 0 deletions .changeset/smart-ties-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/react': patch
---

Removes react-specific entrypoints in `optimizeDeps.include` and rely on `@vitejs/plugin-react` to add
12 changes: 1 addition & 11 deletions packages/integrations/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/solid/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })],
Expand Down
2 changes: 2 additions & 0 deletions packages/integrations/vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
},
Expand Down

0 comments on commit c7642fb

Please sign in to comment.