const webpack = require('webpack'); const configWP = require("./webpack.config"); const compiler = webpack(configWP); compiler.run((err, stats) => { if (err ) { throw err; } if (stats.hasErrors()) { console.error(stats.toString({ chunks: false, // Makes the build much quieter colors: true // Shows colors in the console })); } compiler.close((closeErr) => { if (closeErr) { throw closeErr; } // process.stdout.write(stats.toString() + '\n'); console.log(stats.toString({ chunks: false, // Makes the build much quieter colors: true // Shows colors in the console })); }); });