Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8676b9d

Browse files
docs(Configuration): document css/auto (#6930)
1 parent 7a56e55 commit 8676b9d

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

‎src/content/configuration/module.mdx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ Include all modules that pass test assertion. If you supply a `Rule.test` option
10341034

10351035
`string`
10361036

1037-
Possible values: `'javascript/auto' | 'javascript/dynamic' | 'javascript/esm' | 'json' | 'webassembly/sync' | 'webassembly/async' | 'asset' | 'asset/source' | 'asset/resource' | 'asset/inline'`
1037+
Possible values: `'javascript/auto' | 'javascript/dynamic' | 'javascript/esm' | 'json' | 'webassembly/sync' | 'webassembly/async' | 'asset' | 'asset/source' | 'asset/resource' | 'asset/inline' | 'css/auto'`
10381038

10391039
`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)
10401040

@@ -1058,6 +1058,31 @@ module.exports = {
10581058

10591059
> See [Asset Modules guide](/guides/asset-modules/) for more about `asset*` type.
10601060
1061+
### css/auto
1062+
1063+
<Badge text="5.87.0+" />
1064+
1065+
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`.
1066+
1067+
```js
1068+
module.exports = {
1069+
target: 'web',
1070+
mode: 'development',
1071+
experiments: {
1072+
css: true,
1073+
},
1074+
module: {
1075+
rules: [
1076+
{
1077+
test: /\.less$/,
1078+
use: 'less-loader',
1079+
type: 'css/auto',
1080+
},
1081+
],
1082+
},
1083+
};
1084+
```
1085+
10611086
## Rule.use
10621087

10631088
`[UseEntry]` `function(info)`

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /