@@ -152,14 +152,6 @@ export default function createIntegration(args?: Options): AstroIntegration {
152152 find : 'react-dom/server' ,
153153 replacement : 'react-dom/server.browser' ,
154154 } ,
155- {
156- find : 'solid-js/web' ,
157- replacement : 'solid-js/web/dist/server' ,
158- } ,
159- {
160- find : 'solid-js' ,
161- replacement : 'solid-js/dist/server' ,
162- } ,
163155 ] ;
164156
165157 if ( Array . isArray ( vite . resolve . alias ) ) {
@@ -170,6 +162,11 @@ export default function createIntegration(args?: Options): AstroIntegration {
170162 }
171163 }
172164
165+ vite . resolve . conditions ||= [ ] ;
166+ // We need those conditions, previous these conditions where applied at the esbuild step which we removed
167+ // https://github.com/withastro/astro/pull/7092
168+ vite . resolve . conditions . push ( 'workerd' , 'worker' ) ;
169+
173170 vite . ssr ||= { } ;
174171 vite . ssr . target = 'webworker' ;
175172 vite . ssr . noExternal = true ;
@@ -202,6 +199,17 @@ export default function createIntegration(args?: Options): AstroIntegration {
202199 ...vite . define ,
203200 } ;
204201 }
202+ // we thought that vite config inside `if (target === 'server')` would not apply for client
203+ // but it seems like the same `vite` reference is used for both
204+ // so we need to reset the previous conflicting setting
205+ // in the future we should look into a more robust solution
206+ if ( target === 'client' ) {
207+ vite . resolve ||= { } ;
208+ vite . resolve . conditions ||= [ ] ;
209+ vite . resolve . conditions = vite . resolve . conditions . filter (
210+ ( c ) => c !== 'workerd' && c !== 'worker'
211+ ) ;
212+ }
205213 } ,
206214 'astro:build:done' : async ( { pages, routes, dir, logger } ) => {
207215 const PLATFORM_FILES = [ '_headers' , '_redirects' , '_routes.json' ] ;
0 commit comments