Skip to content

Commit

Permalink
fix: avoid bailout of webpack module concatenation (#1230)
Browse files Browse the repository at this point in the history
Webpack's module concatenation support was broken by v15 due to this `module.exports` line. Changing to ESM export fixes this issue.
  • Loading branch information
fnlctrl authored and yyx990803 committed Apr 9, 2018
1 parent 06e5d70 commit b983304
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/loaders/pitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ module.exports.pitch = function (remainingRequest) {
...beforeLoaders
])
// console.log(request)
// use cjs to ensure exports from (vue-)style-loader/css-loader are intact
return `module.exports = require(${request})`
return `import mod from ${request}; export default mod; export * from ${request}`
}
}

Expand Down Expand Up @@ -66,5 +65,5 @@ module.exports.pitch = function (remainingRequest) {
// both that rule and the cloned rule will match, resulting in duplicated
// loaders. Therefore it is necessary to perform a dedupe here.
const request = genRequest(loaders.map(toLoaderString))
return `module.exports = require(${request})`
return `import mod from ${request}; export default mod; export * from ${request}`
}

0 comments on commit b983304

Please sign in to comment.