close

Deprecated options

This page lists configuration options that have been deprecated in Rspack.

These options are kept for backward compatibility only and should not be used in new projects.

builtin:swc-loader options

rspackExperiments.collectTypeScriptInfo

Used to collect information from TypeScript's AST for consumption by subsequent Rspack processes.

Warning

This configuration has been deprecated. Use top-level collectTypeScriptInfo instead.

{
  loader: 'builtin:swc-loader',
  options: {
-   rspackExperiments: {
-     collectTypeScriptInfo: {
-       exportedEnum: true,
-     },
-   },
+   collectTypeScriptInfo: {
+     exportedEnum: true,
+   },
  },
}

experiments.topLevelAwait

  • Type: boolean
  • Default: true

Enables support for Top-level await. Top-level await can only be used in modules with ModuleType set to javascript/esm.

Enabled by default. Can be disabled with this configuration:

rspack.config.mjs
export default {
  experiments: {
    topLevelAwait: false,
  },
};
Warning

This option has been deprecated and will be removed in Rspack v2.0.

Top-level await will always be enabled in the future. Remove this option from your Rspack configuration.

experiments.lazyCompilation

Used to enable lazy compilation.

Warning

This configuration has been deprecated. Use lazyCompilation instead.

experiments.layers

  • Type: boolean
  • Default: true

Controls whether to enable the layer feature. Layers add an identifier prefix to all modules in a subgraph starting from a module in the module graph, to distinguish them from modules in different layers. For example:

The layer of the index.js module is null by default, and its identifier is ./index.js. If we set layer = 'client' for it, its identifier becomes (client)/./index.js. At this point, the index.js modules in these two different layers are treated as distinct modules, because their unique identifiers differ. The final output includes the artifacts of both modules.

By default, a module's layer is null, and it inherits its parent module's layer. You can add a layer to an entry module using entryOptions.layer, and add a layer to matched modules using module.rule[].layer. Additionally, you can match based on the parent module's layer using module.rule[].issuerLayer.

rspack.config.mjs
export default {
  experiments: {
    layers: true,
  },
};
Warning

This option is deprecated. Layers are now always enabled. Remove this option from your Rspack configuration.

experiments.parallelCodeSplitting

  • Type: boolean
  • Default: false

Enabling this configuration will activate a new multi-threaded code splitting algorithm. If your project includes many dynamic imports and doesn't have cyclic chunks, this can greatly reduce the time spent on the code splitting process.

rspack.config.mjs
export default {
  experiments: {
    parallelCodeSplitting: true,
  },
  optimization: {
    removeAvailableModules: true,
  },
};
Warning

This option is deprecated, it has a huge performance regression in some edge cases where the chunk graph has lots of cycles. We'll improve the performance of build_chunk_graph in the future instead.

Warning

When parallelCodeSplitting is enabled, ensure that 'optimization.removeAvailableModules' is also enabled (this has been enabled by default since version 1.3.0).

This maintains consistency with the previous code splitting algorithm, which enforced removeAvailableModules internally and ignored the optimization.removeAvailableModules configuration.

rules[].loaders

An array to pass the loader package name and its options.

Warning

This option has been deprecated. Use rules[].use instead.

experiments.inlineConst

  • Type: boolean
  • Default: false

Used to enable the experimental feature for cross-module inline optimization for constant exports.

Warning

This configuration has been deprecated and is no longer required. The inline exports optimization is now controlled by optimization.inlineExports instead.

experiments.inlineEnum

  • Type: boolean
  • Default: false

Used to enable inline optimization for TypeScript enums.

Warning

This configuration has been deprecated and is no longer required. Inline enum optimization is now controlled by optimization.inlineExports and builtin:swc-loader collectTypeScriptInfo.exportedEnum.

Please refer to inline enum example for more details.

experiments.lazyBarrel

  • Type: boolean
  • Default: true

Used to enable lazy barrel optimization for skipping the building of unused re-export modules in side-effect-free barrel files.

Warning

This configuration has been deprecated and will be removed in Rspack v2.0. Lazy barrel optimization is already stable and enabled by default. Remove this option from your Rspack configuration.

Tip

Lazy barrel is now a stable feature that is always enabled. It helps optimize build performance by skipping the building of unused re-export modules in side-effect-free barrel files.

For more details, see the Lazy barrel guide.

experiments.typeReexportsPresence

  • Type: boolean
  • Default: false

Used to enable error tolerance for type re-exports.

Warning

This configuration has been deprecated and is no longer required. Type re-exports presence checking is now controlled by module.parser.javascript.typeReexportsPresence and builtin:swc-loader collectTypeScriptInfo.typeExports.

Please refer to type reexports presence example for more details.

module.parser.javascript.inlineConst

  • Type: boolean
  • Default: false

Used to control whether to perform cross-module inline optimization for constant exports in the parser.

Warning

This configuration has been deprecated. Use optimization.inlineExports instead.