File tree 3 files changed +9
-2
lines changed
3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export interface RspackCLIOptions {
24
24
config ?: string ;
25
25
argv ?: Record < string , any > ;
26
26
configName ?: string [ ] ;
27
+ "config-loader" ?: string ;
27
28
}
28
29
29
30
export interface RspackBuildCLIOptions extends RspackCLIOptions {
Original file line number Diff line number Diff line change @@ -61,15 +61,15 @@ export async function loadRspackConfig(
61
61
if ( ! fs . existsSync ( configPath ) ) {
62
62
throw new Error ( `config file "${ configPath } " not found.` ) ;
63
63
}
64
- if ( isTsFile ( configPath ) ) {
64
+ if ( isTsFile ( configPath ) && options [ "config-loader" ] === "register" ) {
65
65
await registerLoader ( configPath ) ;
66
66
}
67
67
return crossImport ( configPath , cwd ) ;
68
68
}
69
69
70
70
const defaultConfig = findConfig ( path . resolve ( cwd , DEFAULT_CONFIG_NAME ) ) ;
71
71
if ( defaultConfig ) {
72
- if ( isTsFile ( defaultConfig ) ) {
72
+ if ( isTsFile ( defaultConfig ) && options [ "config-loader" ] === "register" ) {
73
73
await registerLoader ( defaultConfig ) ;
74
74
}
75
75
return crossImport ( defaultConfig , cwd ) ;
Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ export const commonOptions = (yargs: yargs.Argv) => {
44
44
type : "array" ,
45
45
string : true ,
46
46
describe : "Name of the configuration to use."
47
+ } ,
48
+ "config-loader" : {
49
+ type : "string" ,
50
+ default : "register" ,
51
+ describe :
52
+ "Specify the loader to load the config file, can be `native` or `register`."
47
53
}
48
54
} )
49
55
. alias ( { v : "version" , h : "help" } ) ;
You can’t perform that action at this time.
0 commit comments