1 | var WebpackProdConfig = require('../config/webpack.config.prod');
|
2 |
|
3 | var setupCompiler = require('./setupCompiler');
|
4 | var printErrors = require('./printErrors');
|
5 |
|
6 | module.exports = function (config, dllConfig, callback) {
|
7 | var webpackConfig = WebpackProdConfig(config, dllConfig);
|
8 | var webpackCompiler = setupCompiler(webpackConfig);
|
9 | console.log();
|
10 | console.log('> ' + Object.keys(webpackConfig.entry).join(', ') + ' building...');
|
11 | console.log();
|
12 | webpackCompiler.run((err, stats) => {
|
13 | if (err) {
|
14 | printErrors('Failed to compile.', [err]);
|
15 | process.exit(1);
|
16 | }
|
17 |
|
18 | if (stats.compilation.errors.length) {
|
19 | printErrors('Failed to compile.', stats.compilation.errors);
|
20 | process.exit(1);
|
21 | }
|
22 |
|
23 | if (process.env.CI && stats.compilation.warnings.length) {
|
24 | printErrors('Failed to compile.', stats.compilation.warnings);
|
25 | process.exit(1);
|
26 | }
|
27 |
|
28 | callback && callback(webpackConfig);
|
29 | });
|
30 | };
|