Bug 1333717 - devtools-html: better webpack error messages;r=pbro
Added a custom plugin that will log information extracted from the compilation
stats provided by webpack.
MozReview-Commit-ID: FqRotgjShtD
--- a/devtools/client/inspector/webpack.config.js
+++ b/devtools/client/inspector/webpack.config.js
@@ -8,17 +8,17 @@
const {toolboxConfig} = require("devtools-launchpad/index");
const path = require("path");
const webpack = require("webpack");
module.exports = envConfig => {
let webpackConfig = {
- bail: true,
+ bail: false,
entry: [
path.join(__dirname, "local-toolbox.js")
],
output: {
path: path.join(__dirname, "assets/build"),
filename: "inspector.js",
publicPath: "/"
},
@@ -91,16 +91,32 @@ module.exports = envConfig => {
"reportError": "console.error",
"AppConstants": "{ DEBUG: true, DEBUG_JS_MODULES: true }",
"loader": `{
lazyRequireGetter: () => {},
lazyGetter: () => {}
}`,
"dump": "console.log",
}),
+ function () {
+ this.plugin("done", function (stats) {
+ // Log a verbose error message if the bundle creation failed.
+ if (stats.compilation.errors && stats.compilation.errors.length) {
+ console.error("\nError: Failed to create inspector bundle. Details below.\n");
+ stats.compilation.errors.forEach(e => {
+ console.error(`Error in [${e.module.userRequest}]`);
+ console.error(`Loaders: ${e.module.loaders.join(", ")}`);
+ console.error(e.error);
+ });
+
+ // Exit after failure.
+ process.exit(-1);
+ }
+ });
+ }
]
};
webpackConfig.externals = [
/codemirror\//,
{
"promise": "var Promise",
"devtools/server/main": "{}",