You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/ui/build/runWebpack.js

20 lines
582 B
JavaScript

/* eslint-disable import/no-extraneous-dependencies */
import webpack from 'webpack';
import webpackConfig from './config/webpack';
export default function ({ watch, production }) {
const compiler = webpack(webpackConfig({ watch, production }));
function compilerCallback(err, stats) {
if (err) {
console.error(err.stack || err);
if (err.details) console.error(err.details);
process.exit(1);
}
if (!watch && stats.hasErrors()) process.exitCode = 1;
}
if (watch) compiler.watch({}, compilerCallback);
else compiler.run(compilerCallback);
}