Skip to content

Commit 8514da2

Browse files
committed
make purgecss ignores css module classes
1 parent 83b94b5 commit 8514da2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

template/poi.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ module.exports = {
1010
require('@poi/plugin-eslint')(),<% if(pwa) { %>
1111
require('@poi/plugin-offline')(),<% } %>
1212
],
13+
chainWebpack(config) {
14+
['css', 'scss', 'sass', 'less', 'stylus'].forEach(lang => {
15+
config.module
16+
.rule(lang)
17+
.oneOf('module-ext')
18+
.use('css-loader')
19+
.tap(option => ({
20+
...option,
21+
localIdentName: 'module__[local]_[hash:base64:8]',
22+
}));
23+
});
24+
},
1325
configureWebpack(config) {
1426
if (config.mode === 'production') {
1527
<% if(tailwindcss) { %>

template/purgecss.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ module.exports = new PurgecssPlugin({
2222
},
2323
],
2424
whitelist: ['html', 'body'].concat(PurgecssWhitelister([])),
25-
whitelistPatterns: [],
25+
whitelistPatterns: [
26+
/^module__*/, // css module
27+
],
2628
});

0 commit comments

Comments
 (0)