mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Removes unnecessary warnings from webpack output about missing exports
This should not break anything as ForkTsCheckerWebpackPlugin takes care of that
This commit is contained in:
parent
a9808ef518
commit
0571ad5ad7
22
scripts/webpack/IgnoreNotFoundExportPlugin.js
Normal file
22
scripts/webpack/IgnoreNotFoundExportPlugin.js
Normal file
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ const webpack = require('webpack');
|
|||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
|
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
|
||||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||||
|
const IgnoreNotFoundExportPlugin = require("./IgnoreNotFoundExportPlugin.js");
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
entry: {
|
entry: {
|
||||||
@ -111,5 +112,6 @@ module.exports = merge(common, {
|
|||||||
NODE_ENV: JSON.stringify('development'),
|
NODE_ENV: JSON.stringify('development'),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
new IgnoreNotFoundExportPlugin(),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user