diff --git a/README.md b/README.md index bf95021e..b5eec1db 100644 --- a/README.md +++ b/README.md @@ -980,11 +980,13 @@ module.exports = { ##### `namedExport` -Type: `Boolean` +Type: `Boolean|Function` Default: `false` Enables/disables ES modules named export for locals. +###### `Boolean` + > ⚠ Names of locals are converted to camelcase, i.e. the `exportLocalsConvention` option has `camelCaseOnly` value by default. > ⚠ It is not allowed to use JavaScript reserved words in css class names. @@ -1031,6 +1033,32 @@ module.exports = { }; ``` +###### `Function` + +If `namedExport` function, `exportLocalsConvention` option is ignored; + +**webpack.config.js** + +```js +module.exports = { + module: { + rules: [ + { + test: /\.css$/i, + loader: "css-loader", + options: { + modules: { + namedExport: function (name) { + return name.replace(/-/g, "_"); + }, + }, + }, + }, + ], + }, +}; +``` + ##### `exportGlobals` Type: `Boolean`