For custom CSS Modules configuration.
The auto configuration option allows CSS modules to be automatically enabled based on their filenames.
boolean | RegExp | ((resourcePath: string) => boolean)trueType description:
true: enable CSS modules for all files matching /\.module\.\w+$/i.test(filename) regexp.false: disables CSS Modules.RegExp: enable CSS modules for all files matching /RegExp/i.test(filename) regexp.function: enable CSS Modules for files based on the filename satisfying your filter function check.Style of exported class names.
'camelCase'Type description:
asIs Class names will be exported as is.camelCase Class names will be camelized, the original class name will not to be removed from the locals.camelCaseOnly Class names will be camelized, the original class name will be removed from the locals.dashes Only dashes in class names will be camelized.dashesOnly Dashes in class names will be camelized, the original class name will be removed from the locals.stringSets the format of the className generated by CSS Modules after compilation.
localIdentName has different default values in development and production.
In a production, Rsbuild will generate shorter class names to reduce the bundle size.
You can use the following template strings in localIdentName:
[name] - the basename of the asset.[local] - original class.[hash] - the hash of the string.[folder] - the folder relative path.[path] - the relative path.[file] - filename and path.[ext] - extension with leading dot.[hash:<hashDigest>:<hashDigestLength>]: hash with hash settings.When using Rspack as the bundler, currently does not support custom <hashDigest>.
Set localIdentName to other value: