cwd: The root path of the current build, the default value is process.cwd().
provider: Used to switch the underlying bundler.
rsbuildConfig: Rsbuild configuration object. Rsbuild provides a rich set of configuration options that allow you to customize the build behavior flexibly. You can find all available configuration options in the Configuration section.
functionloadConfig(params:{// Default is process.cwd() cwd:string;// Specify the configuration file, can be a relative or absolute path path?:string;}):Promise<RsbuildConfig>;
Load the .env file and return all environment variables starting with the specified prefixes.
Type:
functionloadEnv(params:{// Default is process.cwd() cwd?:string;// Default is ['PUBLIC_'] prefixes?:string[];}):Promise<{// All environment variables in the .env file parsed: Record<string,string>;// Environment variables starting with the specified prefixes publicVars: Record<string,string>;}>;
Used to merge multiple Rsbuild configuration objects.
The mergeRsbuildConfig function takes multiple configuration objects as parameters. It deep merges each configuration object, automatically combining multiple function values into an array of sequentially executed functions, and returns a merged configuration object.
Used to output log information in a unified format, based on rslog.
Example:
import{ logger }from'@rsbuild/core';// A gradient welcome loglogger.greet(`\n➜ Rsbuild v1.0.0\n`);// Infologger.info('This is a info message');// Startlogger.start('This is a start message');// Warnlogger.warn('This is a warn message');// Readylogger.ready('This is a ready message');// Successlogger.success('This is a success message');// Errorlogger.error('This is a error message');logger.error(newError('This is a error message with stack'));// Debuglogger.debug('This is a debug message');// Same as console.loglogger.log('This is a log message');