Announcing Rsbuild 0.2
December 11, 2023
The Rsbuild 0.2 contains some incompatible API changes. Please refer to the current documentation for upgrading.
Targets
We will move the target
option of createRsbuild
to rsbuild config, this change allows user to configure targets
in the rsbuild config file.
const rsbuild = await createRsbuild({
target: ['web', 'node'],
});
// rsbuild.config.ts
export default {
output: {
targets: ['web', 'node'],
},
};
Only affect JavaScript API. Users using the Rsbuild CLI do not need to change.
Entry
Remove the deprecated source.entries
config.
source.entries
has been renamed to source.entry
since Rsbuild 0.1.0, and we will remove the legacy source.entries
config in Rsbuild v0.2.0.
// rsbuild.config.ts
export default {
source: {
entries: {},
},
};
// rsbuild.config.ts
export default {
source: {
entry: {},
},
};
Write to Disk
dev.writeToDisk
defaults to false
.
Motivation:
- Reduce fs overhead and improve dev server performance.
- Avoid trigger watcher of UnoCSS and other tools. See #654.
- Align the default behavior with webpack-dev-middleware and other community dev servers.
User can enable writeToDisk manually:
export default {
dev: {
writeToDisk: true,
},
};
Babel Plugin
@rsbuild/plugin-babel
will move all babel-loader options to babelLoaderOptions
:
pluginBabel({
plugins: [],
presets: [],
});
pluginBabel([
babelLoaderOptions: {
plugins: [],
presets: [],
}
]);
This change allows us to add more options for pluginBabel
, such as include
and exclude
.
Source Map
output.disableSourceMap
has been renamed to output.sourceMap
.
export default {
output: {
disableSourceMap: {
js: true,
css: true,
},
},
};
export default {
output: {
sourceMap: {
js: false,
css: false,
},
},
};
The default value of source map has also been updated to improve build performance.
- before: generate JS / CSS source map in development, generate JS source map in production.
- after: generate JS source map in development, no source map are generated in production.
Inject Styles
Rename output.disableCssExtract
to output.injectStyles
to be clearer:
export default {
output: {
disableCssExtract: true,
},
};
export default {
output: {
injectStyles: true,
},
};