File tree 2 files changed +31
-6
lines changed
2 files changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,31 @@ import * as style from "./style.css";
27
27
console .log (style .myClass );
28
28
```
29
29
30
+ To restore 6.x behavior, please use:
31
+
32
+ ``` js
33
+ module .exports = {
34
+ module: {
35
+ rules: [
36
+ {
37
+ test: / \. css$ / i ,
38
+ loader: " css-loader" ,
39
+ options: {
40
+ modules: {
41
+ namedExport: false ,
42
+ exportLocalsConvention: ' as-is' ,
43
+ //
44
+ // or, if you prefer camelcase style
45
+ //
46
+ // exportLocalsConvention: 'camel-case-only'
47
+ },
48
+ },
49
+ },
50
+ ],
51
+ },
52
+ };
53
+ ```
54
+
30
55
* The ` modules.exportLocalsConvention ` has the value ` as-is ` when the ` modules.namedExport ` option is ` true ` and you don't specify a value
31
56
* Minimum supported webpack version is ` 5.27.0 `
32
57
* Minimum supported Node.js version is ` 18.12.0 `
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ Then add the plugin to your `webpack` config. For example:
47
47
** file.js**
48
48
49
49
``` js
50
- import css from " file.css" ;
50
+ import * as css from " file.css" ;
51
51
```
52
52
53
53
** webpack.config.js**
@@ -1174,11 +1174,11 @@ Enables/disables ES modules named export for locals.
1174
1174
``` js
1175
1175
import * as styles from " ./styles.css" ;
1176
1176
1177
+ // If using `exportLocalsConvention: "as-is"` (default value):
1178
+ console .log (styles[" foo-baz" ], styles .bar );
1179
+
1177
1180
// If using `exportLocalsConvention: "camel-case-only"`:
1178
1181
console .log (styles .fooBaz , styles .bar );
1179
-
1180
- // If using `exportLocalsConvention: "as-is"`:
1181
- console .log (styles[" foo-baz" ], styles .bar );
1182
1182
```
1183
1183
1184
1184
You can enable a ES module named export using:
@@ -2337,8 +2337,8 @@ File treated as `CSS Module`.
2337
2337
Using both ` CSS Module ` functionality as well as SCSS variables directly in JavaScript.
2338
2338
2339
2339
``` jsx
2340
- import svars from " variables.scss" ;
2341
- import styles from " Component.module.scss" ;
2340
+ import * as svars from " variables.scss" ;
2341
+ import * as styles from " Component.module.scss" ;
2342
2342
2343
2343
// Render DOM with CSS modules class name
2344
2344
// <div className={styles.componentClass}>
You can’t perform that action at this time.
0 commit comments