From 6082eb32b45638d793e0d17071cc77992ac217a3 Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 23 Nov 2021 10:11:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=E5=8E=BB=E6=8E=89=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E8=BF=87=E7=A8=8B=E4=B8=ADNotFoundExport=E7=9A=84?= =?UTF-8?q?=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webpack/webpack.dev.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index 48bcccbd6..57a22bc5e 100644 --- a/webpack/webpack.dev.js +++ b/webpack/webpack.dev.js @@ -9,6 +9,28 @@ const dirs = require("./dirs"); const common = require("./webpack.common.js"); +const ModuleDependencyWarning = require("webpack/lib/ModuleDependencyWarning"); + +class IgnoreNotFoundExportPlugin { + apply(compiler) { + const messageRegExp = /export '.*'( \(reexported as '.*'\))? was not found in/; + function doneHook(stats) { + stats.compilation.warnings = stats.compilation.warnings.filter(warn => { + if (warn instanceof ModuleDependencyWarning && messageRegExp.test(warn.message)) { + return false; + } + + return true; + }); + } + if (compiler.hooks) { + compiler.hooks.done.tap("IgnoreNotFoundExportPlugin", doneHook); + } else { + compiler.plugin("done", doneHook); + } + } +} + module.exports = merge(common, { devtool: "source-map", output: { @@ -46,5 +68,6 @@ module.exports = merge(common, { }, canPrint: true, }), + new IgnoreNotFoundExportPlugin(), ], }); From 23ff64d12ede3a024c3f01d11a887830737feee2 Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 23 Nov 2021 10:14:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20dev=E6=A8=A1=E5=BC=8Fsource-map?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E4=B8=BAinline-source-map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webpack/webpack.dev.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index 57a22bc5e..d3c0fb5bc 100644 --- a/webpack/webpack.dev.js +++ b/webpack/webpack.dev.js @@ -32,7 +32,7 @@ class IgnoreNotFoundExportPlugin { } module.exports = merge(common, { - devtool: "source-map", + devtool: "inline-source-map", output: { path: dirs.DEST, filename: "[name].js",