File tree Expand file tree Collapse file tree
src/generators/web/bundlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { pathToFileURL } from 'node:url';
55
66import {
77 build as viteBuild ,
8+ defaultClientConditions ,
9+ defaultServerConditions ,
810 mergeConfig ,
911} from 'vite' ;
1012
@@ -159,6 +161,7 @@ export const createViteConfig = ({
159161 vite = { } ,
160162} ) => {
161163 const root = resolve ( vite . root ?? process . cwd ( ) ) ;
164+ const conditions = server ? defaultServerConditions : defaultClientConditions ;
162165
163166 return {
164167 ...vite ,
@@ -186,6 +189,7 @@ export const createViteConfig = ({
186189 { resolve : vite . resolve } ,
187190 {
188191 resolve : {
192+ conditions : [ 'rolldown' , ...conditions ] ,
189193 dedupe : [ 'preact' ] ,
190194
191195 // Vite applies string aliases to matching package subpaths too.
@@ -227,6 +231,7 @@ export const createViteConfig = ({
227231 watch : null ,
228232 lib : false ,
229233
234+ ...( server ? { manifest : false } : { } ) ,
230235 ssr : server ,
231236
232237 // Browser output follows the generator's minification setting. Temporary
@@ -256,6 +261,14 @@ export const createViteConfig = ({
256261 ...vite . ssr ,
257262 external : [ ] ,
258263 noExternal : true ,
264+ resolve : {
265+ ...vite . ssr ?. resolve ,
266+ conditions : [
267+ 'rolldown' ,
268+ ...defaultServerConditions ,
269+ ...( vite . ssr ?. resolve ?. conditions ?? [ ] ) ,
270+ ] ,
271+ } ,
259272 } ,
260273 }
261274 : { } ) ,
You can’t perform that action at this time.
0 commit comments