other.js 735 B

123456789101112131415161718192021222324
  1. const debug = require('debug')('app:bin:compile');
  2. const webpackCompiler = require('../build/webpack-compiler');
  3. const webpackConfig = require('../build/other.webpack.config');
  4. const config = require('../config');
  5. const compile = () => {
  6. debug('Starting compiler.');
  7. return Promise.resolve()
  8. .then(() => webpackCompiler(webpackConfig))
  9. .then(stats => {
  10. if (stats.warnings.length && config.compiler_fail_on_warning) {
  11. throw new Error('Config set to fail on warning, exiting with status code "1".');
  12. }
  13. })
  14. .then(() => {
  15. debug('Compilation completed successfully.');
  16. })
  17. .catch(err => {
  18. debug('Compiler encountered an error.', err);
  19. process.exit(1);
  20. });
  21. };
  22. compile();