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 {
181
181
let needHmr = false ;
182
182
let replaceDev = false ;
183
183
let projectRoot = process . cwd ( ) ;
184
+ let isTestMode = false ;
184
185
185
186
return {
186
187
name : 'solid' ,
@@ -190,6 +191,7 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
190
191
// We inject the dev mode only if the user explicitely wants it or if we are in dev (serve) mode
191
192
replaceDev = options . dev === true || ( options . dev !== false && command === 'serve' ) ;
192
193
projectRoot = userConfig . root ;
194
+ isTestMode = userConfig . mode === 'test' ;
193
195
194
196
if ( ! userConfig . resolve ) userConfig . resolve = { } ;
195
197
userConfig . resolve . alias = normalizeAliases ( userConfig . resolve && userConfig . resolve . alias ) ;
@@ -270,7 +272,12 @@ export default function solidPlugin(options: Partial<Options> = {}): Plugin {
270
272
config . resolve . conditions = [ ...defaultServerConditions ] ;
271
273
}
272
274
}
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
+ ] ;
274
281
} ,
275
282
276
283
configResolved ( config ) {
You can’t perform that action at this time.
0 commit comments