Search Docs
import type { CssExtractRspackPluginOptions, CssExtractRspackLoaderOptions, } from '@rspack/core'; type CSSExtractOptions = { pluginOptions?: CssExtractRspackPluginOptions; loaderOptions?: CssExtractRspackLoaderOptions; };
const defaultOptions = { pluginOptions: { ignoreOrder: true, // 默认值由 Rsbuild 的 output.distPath 和 output.filename 选项决定 filename: 'static/css/[name].css', chunkFilename: 'static/css/async/[name].css', }, loaderOptions: {}, };
>= 0.7.0
Rsbuild 默认使用 CssExtractRspackPlugin 插件将 CSS 提取为独立的文件。
通过 tools.cssExtract 可以更改 CssExtractRspackPlugin 的选项。
tools.cssExtract
CssExtractRspackPluginOptions
export default { tools: { cssExtract: { pluginOptions: { ignoreOrder: false, }, }, }, };
CssExtractRspackLoaderOptions
export default { tools: { cssExtract: { loaderOptions: { esModule: false, }, }, }, };
请参考 CssExtractRspackPlugin 插件文档来了解所有可用的选项。