0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-13 22:11:20 -05:00

Remove custom optimizeDeps.include in react integration (#12923)

This commit is contained in:
Bjorn Lu 2025-01-13 18:36:10 +08:00 committed by GitHub
parent cca3bc934c
commit c7642fb80b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 11 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/solid-js': patch
---
Adds the client entrypoint to `optimizeDeps.include`

View file

@ -0,0 +1,5 @@
---
'@astrojs/react': patch
---
Removes react-specific entrypoints in `optimizeDeps.include` and rely on `@vitejs/plugin-react` to add

View file

@ -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: [

View file

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

View file

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