This section describes some of the core methods provided by Rsbuild.
Create a Rsbuild instance object.
The first parameter of createRsbuild
is a options object, you can pass in the following options:
Description:
cwd
: The root path of the current build, the default value is process.cwd()
.target
: Build target type, the default value is ['web']
, see chapter Build Target for details.configPath
: The path to the config file of higher-level solution (absolute path), this parameter affects the build cache update.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.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.
This method will not modify the config object in the input parameter.