Enable and try out some experimental features.
object
Enable incremental rebuild. true
will try to reuse the results of the last build when rebuild to improve build speed, supports configuration of different stages, the default is enabled.
0.5 removed this options and internally enabled this feature.
boolean | { make?: boolean, emitAsset?: boolean }
true
boolean
true
Once enabled, Rspack will output ECMAScript module syntax whenever possible. For instance, import()
to load chunks, ESM exports to expose chunk data, among others.
boolean
true
Once enabled, Rspack will enable native CSS support, Note that if you're using style-loader
and css-loader
, you should disable this option because style-loader
and css-loader
will conflict with native CSS.
Enable support for top level await, top level await
can only be used in modules with ModuleType is javascript/esm
.
Enabled by default and can be turned off with this configuration.
Type: object
Default: See options down below for details
Used to control whether to enable Rspack future default options, check out the details here.
Type: boolean
Introduced in Version: v0.3.5
Enabled by Default in Version: v0.4.0
Removed in Version: v0.5.0
Description:
This feature primarily addresses three categories of problems: builtins code transformation features, target, and custom Rule.type.
These configuration items should apply to the selected corresponding modules. Using builtins.(relay|react|emotion|pluginImport|decorator)
is equivalent to enabling them globally. This approach is not recommended, so it will be deprecated.
After enabling disableTransformByDefault
, the aforementioned configuration items will become invalid. For a migration guide, refer to builtin:swc-loader/options.rspackExperiments.
For instance, if we want the emotion
transformation to apply to all jsx
files:
For the decorator configuration, you can find and replace in the SWC code, such as legacyDecorator, decoratorMetadata.
In previous versions, we typically set target: ["web", "es5"]
to produce web-compatible and downgraded code. Now, when the disableTransformByDefault
configuration item is enabled, the target
will only be used to control runtime code (except for user-written code, rspack generated code within node_modules, like chunk loading, etc.)
This aligns with webpack's plugin-based design philosophy. You can migrate using builtin:swc-loader
's env
or target
, and precisely control the modules that need to be transpiled:
Note: When disableTransformByDefault
is not enabled, the rspack's built-in transpiler will transpile all content under node_modules
. Therefore, after enabling disableTransformByDefault
, with builtin:swc-loader
combined with exclude: /node_modules/
, ensure the code in node_modules
has been downgraded; otherwise, compatibility issues may arise.
These types have been removed:
"typescript"
"jsx"
"tsx"
For JS-related types, only the following will be retained:
"javascript/auto"
"javascript/esm"
"javascript/dynamic"
With disableTransformByDefault
enabled, rspack will only support input compliant with web standards, aligning with webpack's design philosophy.
After discussions with webpack, both webpack and rspack will offer more out-of-the-box configurations to support non-standard inputs like TypeScript.
Since files with the extensions jsx
, tsx
, and ts
are implicitly set for transpilation, an error will be prompted when disableTransformByDefault
is enabled. You can migrate like this:
boolean
This feature enables the new resolver implementation provided by oxc, which is 5 times faster than the previous resolver implementation.
The new resolver also supports tsconfig project references defined in tsconfig-paths-webpack-plugin. See resolve API for details.
boolean
false
This feature enables the new treeshaking implementation the same as webpack, which would generate more efficient and smaller code
boolean
When this feature is not enabled, options.entry
can still make valid changes after compiler.hooks.afterEnvironment
is called.
With this feature turned on, options.entry
will no longer make valid changes after compiler.hooks.afterEnvironment
call. This behavior is consistent with Webpack, so this configuration is unaffected for users developing applications in Rspack, but should be noted by developers of Rspack plugins or upper-level frameworks.
A common scenario is to prepend entries after the Compiler has been created:
Modifications will not take effect when this configuration is turned on, and you need to make the following changes: