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: README.md
+18-13
Original file line number
Diff line number
Diff line change
@@ -1138,21 +1138,13 @@ Type:
1138
1138
typenamedExport=boolean;
1139
1139
```
1140
1140
1141
-
Default: `false`
1141
+
Default: Depends on the value of the `esModule` option. If the value of the `esModule` options is `true`, this value will also be `true`, otherwise it will be `false`.
1142
1142
1143
1143
Enables/disables ES modules named export for locals.
1144
1144
1145
1145
> **Warning**
1146
1146
>
1147
-
> Names of locals are converted to camelcase, i.e. the `exportLocalsConvention` option has
1148
-
> `camelCaseOnly` value by default. You can set this back to any other valid option but selectors
1149
-
> which are not valid JavaScript identifiers may run into problems which do not implement the entire
1150
-
> modules specification.
1151
-
1152
-
> **Warning**
1153
-
>
1154
-
> It is not allowed to use JavaScript reserved words in css class names unless
1155
-
> `exportLocalsConvention` is `"as-is"`.
1147
+
> It is not allowed to use JavaScript reserved words in css class names unless `exportLocalsConvention` is `"as-is"`.
1156
1148
1157
1149
**styles.css**
1158
1150
@@ -1170,8 +1162,10 @@ Enables/disables ES modules named export for locals.
1170
1162
```js
1171
1163
import*asstylesfrom"./styles.css";
1172
1164
1165
+
// If using `exportLocalsConvention: "camel-case-only"`:
1173
1166
console.log(styles.fooBaz, styles.bar);
1174
-
// or if using `exportLocalsConvention: "as-is"`:
1167
+
1168
+
// If using `exportLocalsConvention: "as-is"`:
1175
1169
console.log(styles["foo-baz"], styles.bar);
1176
1170
```
1177
1171
@@ -1247,7 +1241,18 @@ type exportLocalsConvention =
1247
1241
| ((name:string) =>string);
1248
1242
```
1249
1243
1250
-
Default: based on the `modules.namedExport` option value, if `true` - `camelCaseOnly`, otherwise `as-is`
1244
+
Default: Depends on the value of the `modules.namedExport` option, if `true` - `as-is`, otherwise `camel-case-only`.
1245
+
1246
+
> **Warning**
1247
+
>
1248
+
> Names of locals are converted to camelcase when the named export is `false`, i.e. the `exportLocalsConvention` option has
1249
+
> `camelCaseOnly` value by default. You can set this back to any other valid option but selectors
1250
+
> which are not valid JavaScript identifiers may run into problems which do not implement the entire
1251
+
> modules specification.
1252
+
1253
+
> **Warning**
1254
+
>
1255
+
> **You need to disable `modules.namedExport` if you want to use `'camel-case'` or `'dashes'` value.**
Copy file name to clipboardexpand all lines: test/__snapshots__/modules-option.test.js.snap
+4-4
Original file line number
Diff line number
Diff line change
@@ -2551,8 +2551,8 @@ exports[`"modules" option should throw an error when class has unsupported name
2551
2551
2552
2552
exports[`"modules" option should throw an error when the "namedExport" is enabled and the "exportLocalsConvention" options has not "camelCaseOnly" value: errors 1`] = `
2553
2553
[
2554
-
"ModuleBuildError: Module build failed (from \`replaced original path\`):
2555
-
Error: The "modules.namedExport" option requires the "modules.exportLocalsConvention" option to be "as-is", "camel-case-only" or "dashes-only"",
@@ -2578,8 +2578,8 @@ exports[`"modules" option should throw error when the "exportLocalsConvention" f
2578
2578
2579
2579
exports[`"modules" option should throw error with composes when the "namedExport" is enabled and "exportLocalsConvention" options has invalid value: errors 1`] = `
2580
2580
[
2581
-
"ModuleBuildError: Module build failed (from \`replaced original path\`):
2582
-
Error: The "modules.namedExport" option requires the "modules.exportLocalsConvention" option to be "as-is", "camel-case-only" or "dashes-only"",
0 commit comments