Skip to content

Commit 8b584bd

Browse files
authored
fix: also support passed ES modules from css-loader in addition to CommonJS format (#47)
1 parent 477c25e commit 8b584bd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: index.js

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ module.exports.pitch = function (remainingRequest) {
3636
'',
3737
'// load the styles',
3838
'var content = require(' + request + ');',
39+
// get default export if list is an ES Module (CSS Loader v4+)
40+
"if(content.__esModule) content = content.default;",
3941
// content list format is [id, css, media, sourceMap]
4042
"if(typeof content === 'string') content = [[module.id, content, '']];",
4143
'if(content.locals) module.exports = content.locals;'

0 commit comments

Comments
 (0)