Skip to content

Commit

Permalink
Revert "chore(project): removed css module fix"
Browse files Browse the repository at this point in the history
This reverts commit 907fa4f.
  • Loading branch information
RCVZ committed Jul 19, 2021
1 parent 907fa4f commit 6eea39b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/webpack/css-modules-fix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = function cssModulesFix(source) {
return source.replace(/_(\w+)_[\w\d]{5}_\d+/g, function(fullMatch, originalSelector) {
return originalSelector;
});
};
8 changes: 8 additions & 0 deletions snowpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ module.exports = {
// FIXES https://github.com/snowpackjs/snowpack/discussions/2810
const babelRule = config.module.rules.find((rule) =>
rule && rule.use && rule.use.find((use) => use && use.loader && use.loader.includes('babel-loader')));
const cssModulesRule = config.module.rules.find((rule) =>
rule && rule.use && rule.use.find((use) => use && use.loader && use.loader.includes('css-loader') && use.options && use.options.modules));

if (cssModulesRule) {
cssModulesRule.use.unshift({
loader: require.resolve('./scripts/webpack/css-modules-fix.js'),
});
}

if (babelRule) {
babelRule.use = babelRule.use.filter(use => {
Expand Down

0 comments on commit 6eea39b

Please sign in to comment.