Experiments

实验性功能:该选项通过此配置项可以开启并试用一些实验的功能。

  • 类型: Object

experiments.incrementalRebuild

启用增量重新编译。当启用此选项,Rspack 在重新编译时会尝试复用上次构建的结果来提升构建速度,支持对不同阶段进行配置,默认为开启状态。

  • 类型: boolean | { make?: boolean, emitAsset?: boolean }
  • 默认值: true

experiments.outputModule

  • 类型: boolean
  • 默认值: false

开启之后,将尽可能输出符合 ECMAScript 语法的代码。例如,使用 import() 加载 chunk,使用 ESM exports 等等。

module.exports = {
  experiments: {
    outputModule: true,
  },
};

experiments.css

启用原生 CSS 支持,请注意如果你在使用 style-loadercss-loader 请关闭该配置,因为 style-loadercss-loader 和原生 CSS 功能冲突。