output.disableCssModuleExtension
- Type:
boolean - Default:
false
Whether to treat all .css files in the source directory as CSS Modules.
By default, only the *.module.css files are treated as CSS Modules. After enabling this config, all *.css style files in the source directory will be regarded as CSS Modules.
.sass, .scss and .less files are also affected by disableCssModuleExtension.
We do not recommend enabling this config, because after enabling disableCssModuleExtension, CSS Modules files and ordinary CSS files cannot be clearly distinguished, which is not conducive to long-term maintenance.
Example
Detailed
The following is a detailed explanation of the CSS Modules rules:
disableCssModuleExtension is false (default)
The following files are treated as CSS Modules:
- all
*.module.cssfiles
The following files are treated as normal CSS:
- all
*.cssfiles (excluding.module) - all
*.global.cssfiles
disableCssModuleExtension is true
The following files are treated as CSS Modules:
*.cssand*.module.cssfiles in the source directory*.module.cssfiles under node_modules
The following files are treated as normal CSS:
- all
*.global.cssfiles *.cssfiles under node_modules (without.module)
For CSS Modules files inside node_modules, please always use the *.module.css suffix.