build.js
931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
process.env.NODE_ENV = 'production';
const rm = require('rimraf');
const path = require('path');
const webpack = require('webpack');
const clientConfig = require('./webpack.client.conf');
const serverConfig = require('./webpack.server.conf');
rm(path.join(clientConfig.output.path), err => {
if (err) {
throw err;
}
webpack(clientConfig, (clientErr, clientStats) => {
if (clientErr) {
throw clientErr;
}
process.stdout.write(clientStats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n\n');
webpack(serverConfig, (serverErr, serverStats) => {
if (serverErr) {
throw serverErr;
}
process.stdout.write(serverStats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n\n');
});
});
});