build.js
1.01 KB
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
39
40
41
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');
const pkg = require('../package.json');
const distDir = path.join(__dirname, `../dist/${pkg.name}`);
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');
});
});
});