File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export interface RspackCLIOptions {
2424 config ?: string ;
2525 argv ?: Record < string , any > ;
2626 configName ?: string [ ] ;
27+ "config-loader" ?: string ;
2728}
2829
2930export interface RspackBuildCLIOptions extends RspackCLIOptions {
Original file line number Diff line number Diff line change @@ -61,15 +61,15 @@ export async function loadRspackConfig(
6161 if ( ! fs . existsSync ( configPath ) ) {
6262 throw new Error ( `config file "${ configPath } " not found.` ) ;
6363 }
64- if ( isTsFile ( configPath ) ) {
64+ if ( isTsFile ( configPath ) && options [ "config-loader" ] === "register" ) {
6565 await registerLoader ( configPath ) ;
6666 }
6767 return crossImport ( configPath , cwd ) ;
6868 }
6969
7070 const defaultConfig = findConfig ( path . resolve ( cwd , DEFAULT_CONFIG_NAME ) ) ;
7171 if ( defaultConfig ) {
72- if ( isTsFile ( defaultConfig ) ) {
72+ if ( isTsFile ( defaultConfig ) && options [ "config-loader" ] === "register" ) {
7373 await registerLoader ( defaultConfig ) ;
7474 }
7575 return crossImport ( defaultConfig , cwd ) ;
Original file line number Diff line number Diff line change @@ -44,6 +44,12 @@ export const commonOptions = (yargs: yargs.Argv) => {
4444 type : "array" ,
4545 string : true ,
4646 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`."
4753 }
4854 } )
4955 . alias ( { v : "version" , h : "help" } ) ;
You can’t perform that action at this time.
0 commit comments