The document lists all breaking changes from Rspack v0.7 to v1.0. You can refer to this document for migration.
See Breaking changes in Rspack v1.0.0 for details.
In Rspack 1.x, we have aligned the default configuration values with those of Webpack.
The default value of experiments.css has been changed from true
to false
.
In Rspack 0.x, experiments.css
was enabled by default, which means files ending with*.css
were automatically treated astype: 'css/auto'
without needing to manually include other loaders to process CSS files.
If you rely on the built-in feature to handle CSS files without using any loaders, or if you have used the following configuration to handle CSS files:
Please note that you now need to manually enable experiments.css
.
The default value of optimization.concatenateModules has been changed from false
to:
true
when mode
is 'production'
.false
for other values of mode
.In Rspack 1.x, module concatenation optimization has become more stable. Thus, it's now enabled by default in production mode, allowing multiple modules to be concatenated into a single module to reduce output size and improve compression efficiency.
The default value of devtool has been changed from false
to:
eval
when mode
is 'development'
.false
for other values of mode
.
@rspack/cli
overrides the defaultdevtool
value from@rspack/core
. Therefore, if you are using@rspack/cli
, this change will not affect you.
The default value of experiments.asyncWebAssembly has been changed from false
to depend on the experiments.futureDefaults
configuration. It is enabled by default only when experiments.futureDefaults
is set to true
.
If you are using WebAssembly modules as asynchronous modules, you now need to manually set experiments.asyncWebAssembly
to true
.
The default value of splitChunks.cacheGroups.{cacheGroup}.reuseExistingChunk has been changed from true
to false
.
The default value of optimization.moduleIds has been changed to 'natural'
when mode
is none
.
The default value of optimization.chunkIds has been changed to 'natural'
when mode
is none
.
Please use resolve.tsConfig instead.
Please use output.library.amdContainer instead.
To streamline the core, Rspack 1.x has removed the built-in SWC plugins. You now need to manually include them.
Use @swc/plugin-styled-components instead.
Use @swc/plugin-emotion instead.
Use @swc/plugin-relay instead.
Use @swc/plugin-prefresh instead.
In Rspack 0.x, we used the built-in rspack.SwcCssMinimizerRspackPlugin
to compress CSS size.
Now, we have removed it and replaced it with rspack.LightningCssMinimizerRspackPlugin to handle the same functionality.
If you previously manually registered and configured rspack.SwcCssMinimizerRspackPlugin
, you should to switch to rspack.LightningCssMinimizerRspackPlugin
:
Rspack's built-in and default-enabled JavaScript minimizer plugin has had its configuration aligned with SWC's minification configuration. The breaking changes are as follows:
minimizerOptions.passes
: moved to minimizerOptions.compress.passes
minimizerOptions.dropConsole
: moved to minimizerOptions.compress.drop_console
minimizerOptions.pureFuncs
: moved to minimizerOptions.compress.pure_funcs
minimizerOptions.keepClassNames
: moved to minimizerOptions.mangle.keep_classnames
minimizerOptions.keepFnNames
: moved to minimizerOptions.mangle.keep_fnames
minimizerOptions.comments
: moved to minimizerOptions.format.comments
minimizerOptions.asciiOnly
: moved to minimizerOptions.format.ascii_only
Default Value Changes:
comments
(options.format.comments
): changed from false
to "some"
We have aligned its configuration with html-webpack-plugin, with the following breaking changes:
excludedChunks
has been renamed to excludeChunks
mode
is 'production'
, minify
is now true
by default@rspack/cli
has upgraded its dependency on webpack-dev-server
from v4 to v5. If you are using @rspack/cli
, please be aware of the following breaking changes:
ResolverFactory
and Resolver
have been refactored with Rust to unify the implementations on the JS and Rust sides. Due to this change, ResolverFactory
and Resolver
currently do not support any hooks.
Additionally, Resolver
now only supports the following methods:
resolveSync
resolve
withOptions
This change might cause some plugins to become unusable.
Rspack supports the NormalModuleFactory's resolve hook. In most cases, you can use this hook as a replacement for the Resolver
's resolve
hook to achieve the same functionality.