SimpleBuilder.js 764 B

123456789101112131415161718192021222324252627
  1. const webpack = require('webpack');
  2. const configWP = require("./webpack.config");
  3. const compiler = webpack(configWP);
  4. compiler.run((err, stats) => {
  5. if (err ) {
  6. throw err;
  7. }
  8. if (stats.hasErrors()) {
  9. console.error(stats.toString({
  10. chunks: false, // Makes the build much quieter
  11. colors: true // Shows colors in the console
  12. }));
  13. }
  14. compiler.close((closeErr) => {
  15. if (closeErr) {
  16. throw closeErr;
  17. }
  18. // process.stdout.write(stats.toString() + '\n');
  19. console.log(stats.toString({
  20. chunks: false, // Makes the build much quieter
  21. colors: true // Shows colors in the console
  22. }));
  23. });
  24. });