File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ export async function init({
101101
102102 const rsbuild = await createRsbuild ( {
103103 cwd : root ,
104- rsbuildConfig : ( ) => loadConfig ( root ) ,
104+ config : ( ) => loadConfig ( root ) ,
105105 environment : commonOpts . environment ,
106106 loadEnv :
107107 commonOpts . env === false
Original file line number Diff line number Diff line change @@ -168,9 +168,10 @@ export async function createRsbuild(
168168 } )
169169 : null ;
170170
171- const config = isFunction ( options . rsbuildConfig )
172- ? await options . rsbuildConfig ( )
173- : options . rsbuildConfig || { } ;
171+ const configOrFactory = options . config ?? options . rsbuildConfig ;
172+ const config = isFunction ( configOrFactory )
173+ ? await configOrFactory ( )
174+ : configOrFactory || { } ;
174175
175176 // debug mode should always verbose logs
176177 if ( config . logLevel && ! isDebug ( ) ) {
Original file line number Diff line number Diff line change @@ -150,11 +150,16 @@ export type CreateRsbuildOptions = {
150150 * If not specified or passing an empty array, all environments will be built.
151151 */
152152 environment ?: string [ ] ;
153+ /**
154+ * Alias for `config`.
155+ * This option will be deprecated in the future.
156+ */
157+ rsbuildConfig ?: RsbuildConfig | ( ( ) => Promise < RsbuildConfig > ) ;
153158 /**
154159 * Rsbuild configurations.
155160 * Passing a function to load the config asynchronously with custom logic.
156161 */
157- rsbuildConfig ?: RsbuildConfig | ( ( ) => Promise < RsbuildConfig > ) ;
162+ config ?: RsbuildConfig | ( ( ) => Promise < RsbuildConfig > ) ;
158163 /**
159164 * Whether to call `loadEnv` to load environment variables and define them
160165 * as global variables via `source.define`.
You can’t perform that action at this time.
0 commit comments