diff --git a/src/content/configuration/module.mdx b/src/content/configuration/module.mdx index fcb096770f6d..77f234830859 100644 --- a/src/content/configuration/module.mdx +++ b/src/content/configuration/module.mdx @@ -1034,7 +1034,7 @@ Include all modules that pass test assertion. If you supply a `Rule.test` option `string` -Possible values: `'javascript/auto' | 'javascript/dynamic' | 'javascript/esm' | 'json' | 'webassembly/sync' | 'webassembly/async' | 'asset' | 'asset/source' | 'asset/resource' | 'asset/inline'` +Possible values: `'javascript/auto' | 'javascript/dynamic' | 'javascript/esm' | 'json' | 'webassembly/sync' | 'webassembly/async' | 'asset' | 'asset/source' | 'asset/resource' | 'asset/inline' | 'css/auto'` `Rule.type` sets the type for a matching module. This prevents defaultRules and their default importing behaviors from occurring. For example, if you want to load a `.json` file through a custom loader, you'd need to set the `type` to `javascript/auto` to bypass webpack's built-in json importing. (See [v4.0 changelog](https://github.com/webpack/webpack/releases/tag/v4.0.0) for more details) @@ -1058,6 +1058,31 @@ module.exports = { > See [Asset Modules guide](/guides/asset-modules/) for more about `asset*` type. +### css/auto + + + +See use case of `css/auto` module type [here](https://github.com/webpack/webpack/issues/16572). Make sure to enable [`experiments.css`](/configuration/experiments/#experimentscss) to use `css/auto`. + +```js +module.exports = { + target: 'web', + mode: 'development', + experiments: { + css: true, + }, + module: { + rules: [ + { + test: /\.less$/, + use: 'less-loader', + type: 'css/auto', + }, + ], + }, +}; +``` + ## Rule.use `[UseEntry]` `function(info)`