From af217db55056aa4707c103153383cf2d2933eabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E9=93=84=E8=BF=90?= Date: Mon, 9 Apr 2018 01:19:09 +0800 Subject: [PATCH 1/3] Use ESM export to support webpack module concatenation Webpack's module concatenation support was broken by v15 due to this `module.exports` line. Changing to ESM export fixes this issue. --- lib/loaders/pitcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/loaders/pitcher.js b/lib/loaders/pitcher.js index 83864da77..1878622c3 100644 --- a/lib/loaders/pitcher.js +++ b/lib/loaders/pitcher.js @@ -66,5 +66,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` } From 511d5ac653b61182b70c6d5b8bad714531c6a5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E9=93=84=E8=BF=90?= Date: Mon, 9 Apr 2018 01:26:43 +0800 Subject: [PATCH 2/3] fix named exports --- lib/loaders/pitcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/loaders/pitcher.js b/lib/loaders/pitcher.js index 1878622c3..c1d0dc169 100644 --- a/lib/loaders/pitcher.js +++ b/lib/loaders/pitcher.js @@ -66,5 +66,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 `import mod from ${request}; export default mod` + return `import mod from ${request}; export default mod; export * from ${request}` } From bd85a9b09fb8826b8968c6126bea2dd5a8b69a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E9=93=84=E8=BF=90?= Date: Mon, 9 Apr 2018 02:08:03 +0800 Subject: [PATCH 3/3] try also using esm export for style --- lib/loaders/pitcher.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/loaders/pitcher.js b/lib/loaders/pitcher.js index c1d0dc169..fecb3985c 100644 --- a/lib/loaders/pitcher.js +++ b/lib/loaders/pitcher.js @@ -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}` } }