You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config/README.md
+1-14
Original file line number
Diff line number
Diff line change
@@ -245,22 +245,9 @@ See [the plugin's README](https://github.com/vuejs/vue-cli/blob/dev/packages/%40
245
245
246
246
### css.modules
247
247
248
-
Deprecated since v4, please use [`css.requireModuleExtension`](#css-requireModuleExtension) instead.
249
-
250
-
In v3 this means the opposite of `css.requireModuleExtension`.
251
-
252
248
### css.requireModuleExtension
253
249
254
-
- Type: `boolean`
255
-
- Default: `true`
256
-
257
-
By default, only files that ends in `*.module.[ext]` are treated as CSS modules. Setting this to `false` will allow you to drop `.module` in the filenames and treat all `*.(css|scss|sass|less|styl(us)?)` files as CSS modules.
258
-
259
-
::: tip
260
-
If you have customized CSS Modules configurations in `css.loaderOptions.css`, then the `css.requireModuleExtension` field must be explicitly configured to `true` or `false`, otherwise we can't be sure whether you want to apply these options to all CSS files or not.
261
-
:::
262
-
263
-
See also: [Working with CSS > CSS Modules](../guide/css.md#css-modules)
250
+
Both removed in v5, see [Working with CSS > CSS Modules](../guide/css.md#css-modules) for guidance on how to treat all style imports as CSS Modules.
Copy file name to clipboardExpand all lines: docs/guide/css.md
+17-9
Original file line number
Diff line number
Diff line change
@@ -81,40 +81,48 @@ In the production build, Vue CLI optimizes your CSS and will drop unnecessary ve
81
81
82
82
You can [use CSS Modules in `*.vue` files](https://vue-loader.vuejs.org/en/features/css-modules.html) out of the box with `<style module>`.
83
83
84
-
To import CSS or other pre-processor files as CSS Modules in JavaScript, the filename should end with `.module.(css|less|sass|scss|styl)`:
84
+
To import CSS or other pre-processor files as CSS Modules in JavaScript, the filename should end with `.module(s).(css|less|sass|scss|styl)`:
85
85
86
86
```js
87
87
importstylesfrom'./foo.module.css'
88
88
// works for all supported pre-processors as well
89
89
importsassStylesfrom'./foo.module.scss'
90
90
```
91
91
92
-
If you want to drop the `.module` in the filenames, set `css.requireModuleExtension` to `false` in `vue.config.js`:
92
+
If you want to drop the `.module` in the file names and treat all style files as CSS Modules, you need to configure the `css-loader` option as follows:
93
93
94
94
```js
95
95
// vue.config.js
96
96
module.exports= {
97
97
css: {
98
-
requireModuleExtension:false
98
+
loaderOptions: {
99
+
css: {
100
+
modules: {
101
+
auto: () =>true
102
+
}
103
+
}
104
+
}
99
105
}
100
106
}
101
107
```
102
108
103
-
If you wish to customize the generated CSS modules class names, you can do so via `css.loaderOptions.css` in `vue.config.js`. All `css-loader` options are supported here, for example `localIdentName` and `camelCase`:
109
+
If you wish to customize the generated CSS Modules class names, you can do so via `css.loaderOptions.css` in `vue.config.js`, too. All `css-loader` options are supported here:
104
110
105
111
```js
106
112
// vue.config.js
107
113
module.exports= {
108
114
css: {
109
115
loaderOptions: {
110
116
css: {
111
-
// Note: the following config format is different between Vue CLI v4 and v3
112
-
// For Vue CLI v3 users, please refer to css-loader v1 documentations
Copy file name to clipboardExpand all lines: docs/migrations/migrate-from-v4.md
+6
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,12 @@ Underlyingly, it uses the [`resolutions`](https://classic.yarnpkg.com/en/docs/se
72
72
73
73
Though both work in all our tests, please be aware that the `module-alias` approach is still considered hacky, and may not be as stable as the `"resolutions"` one.
74
74
75
+
#### CSS Modules
76
+
77
+
The `css.requireModuleExtension` option is removed. If you do need to strip the `.module` part in CSS Module file names, please refer to [Working with CSS > CSS Modules](../guide/css.md#css-modules) for more guidance.
78
+
79
+
`css-loader` is upgraded from v3 to v5, a few CSS Module related options have been renamed, along with other changes. See [full changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md) for additional details.
80
+
75
81
#### Sass/SCSS
76
82
77
83
No longer supports generating project with `node-sass`. It has been [deprecated](https://sass-lang.com/blog/libsass-is-deprecated#how-do-i-migrate) for a while. Please use the `sass` package instead.
0 commit comments