Skip to content

Commit

Permalink
fix: also support passed ES modules from css-loader in addition to …
Browse files Browse the repository at this point in the history
…CommonJS format (#47)
  • Loading branch information
foxxyz committed Mar 3, 2021
1 parent 477c25e commit 8b584bd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.js
Expand Up @@ -36,6 +36,8 @@ module.exports.pitch = function (remainingRequest) {
'',
'// load the styles',
'var content = require(' + request + ');',
// get default export if list is an ES Module (CSS Loader v4+)
"if(content.__esModule) content = content.default;",
// content list format is [id, css, media, sourceMap]
"if(typeof content === 'string') content = [[module.id, content, '']];",
'if(content.locals) module.exports = content.locals;'
Expand Down

0 comments on commit 8b584bd

Please sign in to comment.