-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (22 loc) · 717 Bytes
/
index.js
File metadata and controls
25 lines (22 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function handler(module, filename) {
module.exports = new Proxy({}, {
get: function(target, property, receiver) {
// Without this, __esModule will return "__esModule" which will confuse
// babel into thinking this module was built with ES6 exports since it's
// "truthy". So, in this one special case, we return a value (false).
if (property === '__esModule') return false;
return property;
}
});
};
function registerHandlers(extensions) {
if (extensions.constructor !== Array)
extensions = [extensions];
extensions.forEach(function(ext) {
require.extensions[ext] = handler;
});
}
registerHandlers('.css');
module.exports = {
register: registerHandlers
};