tools.cssExtract

  • 类型:
type CSSExtractOptions = {
  pluginOptions?: Rspack.CssExtractRspackPluginOptions;
  loaderOptions?: Rspack.CssExtractRspackLoaderOptions;
};
  • 默认值:
const defaultOptions = {
  pluginOptions: {
    ignoreOrder: true,
    // 默认值由 Rsbuild 的 output.distPath 和 output.filename 选项决定
    filename: 'static/css/[name].css',
    chunkFilename: 'static/css/async/[name].css',
  },
  loaderOptions: {},
};

通过 tools.cssExtract 可以更改 CssExtractRspackPluginmini-css-extract-plugin 的配置。

INFO

该配置项的使用方式与 Rsbuild 完全一致。详细信息请参考 Rsbuild - tools.cssExtract