Browse Source

Pull request #2300: 无JIRA任务 去掉编译过程中无用的NotFoundExport的警告 + 使用inline-source-map

Merge in VISUAL/fineui from ~TELLER/fineui:master to master

* commit '23ff64d12ede3a024c3f01d11a887830737feee2':
  chore: dev模式source-map替换为inline-source-map
  chore: 去掉编译过程中NotFoundExport的警告
es6
Teller 3 years ago
parent
commit
ed9590f979
  1. 25
      webpack/webpack.dev.js

25
webpack/webpack.dev.js

@ -9,8 +9,30 @@ 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",
devtool: "inline-source-map",
output: {
path: dirs.DEST,
filename: "[name].js",
@ -46,5 +68,6 @@ module.exports = merge(common, {
},
canPrint: true,
}),
new IgnoreNotFoundExportPlugin(),
],
});

Loading…
Cancel
Save