We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 199897f commit 32eefd9Copy full SHA for 32eefd9
lib/loader.js
@@ -88,7 +88,16 @@ module.exports = function(content, map) {
88
89
var exportJs = compileExports(result, importItemMatcher.bind(this), camelCaseKeys);
90
if (exportJs) {
91
- exportJs = "exports.locals = " + exportJs + ";";
+ if (query.cssModuleDevWarnings) {
92
+ exportJs = "exports.locals = new Proxy(" + exportJs + "," +
93
+ "{ get(target, property) { " +
94
+ "if (typeof target[property] !== 'string' && property !== '__esModule') {" +
95
+ "console.warn(`Attempted to access non-existent className '${property} on CSS module'`)" +
96
+ "} else { return target[property] }" +
97
+ "}})";
98
+ } else {
99
+ exportJs = "exports.locals = " + exportJs + ";"
100
+ }
101
}
102
103
var moduleJs;
0 commit comments