mirror of https://github.com/grafana/grafana
Merge pull request #14779 from grafana/tooling/ignore-not-found-export-warnings
Removes unnecessary warnings from webpack output about missing exportspull/14813/head
commit
322a3efb25
@ -0,0 +1,22 @@ |
||||
// https://github.com/TypeStrong/ts-loader/issues/653#issuecomment-390889335
|
||||
|
||||
const ModuleDependencyWarning = require("webpack/lib/ModuleDependencyWarning") |
||||
|
||||
module.exports = class IgnoreNotFoundExportPlugin { |
||||
apply(compiler) { |
||||
const messageRegExp = /export '.*'( \(reexported as '.*'\))? was not found in/ |
||||
function doneHook(stats) { |
||||
stats.compilation.warnings = stats.compilation.warnings.filter(function(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) |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue