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) { ...@@ -37,8 +37,7 @@ module.exports.pitch = function (remainingRequest) {
...beforeLoaders ...beforeLoaders
]) ])
// console.log(request) // console.log(request)
// use cjs to ensure exports from (vue-)style-loader/css-loader are intact return `import mod from ${request}; export default mod; export * from ${request}`
return `module.exports = require(${request})`
} }
} }
...@@ -66,5 +65,5 @@ module.exports.pitch = function (remainingRequest) { ...@@ -66,5 +65,5 @@ module.exports.pitch = function (remainingRequest) {
// both that rule and the cloned rule will match, resulting in duplicated // both that rule and the cloned rule will match, resulting in duplicated
// loaders. Therefore it is necessary to perform a dedupe here. // loaders. Therefore it is necessary to perform a dedupe here.
const request = genRequest(loaders.map(toLoaderString)) 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