File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed
packages-engine/config/src
packages-integrations/vite/src Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ export async function loadConfig<U extends UserConfig>(
1616 defaults : UserConfigDefaults = { } ,
1717) : Promise < LoadConfigResult < U > > {
1818 let inlineConfig = { } as U
19+ let hasUserCustomConfig = false
20+
1921 if ( typeof configOrPath !== 'string' ) {
22+ hasUserCustomConfig = true
2023 inlineConfig = configOrPath
2124 if ( inlineConfig . configFile === false ) {
2225 return {
@@ -60,16 +63,16 @@ export async function loadConfig<U extends UserConfig>(
6063 ...extraConfigSources ,
6164 ] ,
6265 cwd,
63- defaults : inlineConfig ,
6466 } )
6567
6668 const result = await loader . load ( )
6769
68- if ( ! isFile && ! result . sources ?. length ) {
70+ if ( ! hasUserCustomConfig && ! isFile && ! result . config ) {
6971 consola . error ( `[@unocss/config] Config file not found in ${ cyan ( configOrPath ) } - loading default config.` )
7072 }
7173
7274 result . config = Object . assign ( defaults , inlineConfig , result . config ?? { } )
75+
7376 if ( result . config . configDeps ) {
7477 result . sources = [
7578 ...result . sources ,
Original file line number Diff line number Diff line change @@ -32,15 +32,16 @@ export default function UnocssPlugin<Theme extends object>(
3232 configOrPath ?: VitePluginConfig < Theme > | string ,
3333 defaults : UserConfigDefaults = { } ,
3434) : Plugin [ ] {
35- const ctx = createContext < VitePluginConfig > ( configOrPath as any , {
36- envMode : process . env . NODE_ENV === 'development'
37- ? 'dev'
38- : 'build' ,
39- ...defaults ,
40- legacy : typeof configOrPath !== 'string'
41- ? ( configOrPath ?. legacy || { renderModernChunks : true } )
42- : { renderModernChunks : true } ,
43- } )
35+ const ctx = createContext < VitePluginConfig > (
36+ configOrPath as any ,
37+ {
38+ envMode : process . env . NODE_ENV === 'development' ? 'dev' : 'build' ,
39+ ...defaults ,
40+ legacy : typeof configOrPath !== 'string'
41+ ? ( configOrPath ?. legacy || { renderModernChunks : true } )
42+ : { renderModernChunks : true } ,
43+ } ,
44+ )
4445 const inlineConfig = ( configOrPath && typeof configOrPath !== 'string' ) ? configOrPath : { }
4546 const mode = inlineConfig . mode ?? 'global'
4647
You can’t perform that action at this time.
0 commit comments