File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " vite-plugin-solid " : patch
3+ ---
4+
5+ Fix vite6 environment detection
Original file line number Diff line number Diff line change @@ -181,6 +181,7 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
181181 let needHmr = false ;
182182 let replaceDev = false ;
183183 let projectRoot = process . cwd ( ) ;
184+ let isTestMode = false ;
184185
185186 return {
186187 name : 'solid' ,
@@ -190,6 +191,7 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
190191 // We inject the dev mode only if the user explicitely wants it or if we are in dev (serve) mode
191192 replaceDev = options . dev === true || ( options . dev !== false && command === 'serve' ) ;
192193 projectRoot = userConfig . root ;
194+ isTestMode = userConfig . mode === 'test' ;
193195
194196 if ( ! userConfig . resolve ) userConfig . resolve = { } ;
195197 userConfig . resolve . alias = normalizeAliases ( userConfig . resolve && userConfig . resolve . alias ) ;
@@ -270,7 +272,12 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
270272 config . resolve . conditions = [ ...defaultServerConditions ] ;
271273 }
272274 }
273- config . resolve . conditions . push ( 'solid' ) ;
275+ config . resolve . conditions = [
276+ 'solid' ,
277+ ...( replaceDev ? [ 'development' ] : [ ] ) ,
278+ ...( isTestMode && ! opts . isSsrTargetWebworker ? [ 'browser' ] : [ ] ) ,
279+ ...config . resolve . conditions ,
280+ ] ;
274281 } ,
275282
276283 configResolved ( config ) {
You can’t perform that action at this time.
0 commit comments