Commit b9833041 authored by 宋铄运's avatar 宋铄运 Committed by Evan You

fix: avoid bailout of webpack module concatenation (#1230)

Webpack's module concatenation support was broken by v15 due to this `module.exports` line. Changing to ESM export fixes this issue.
parent 06e5d70d
......@@ -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}`
}
}
......@@ -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}`
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment