1 | const webpack = require('webpack')
|
2 | const createWebpackConfig = require('../src/config/createWebpackConfig')
|
3 |
|
4 | const args = process.argv.slice(2)
|
5 |
|
6 | const serverConfig = createWebpackConfig('node')
|
7 | const clientConfig = createWebpackConfig('web')
|
8 |
|
9 | const configs = [serverConfig, clientConfig]
|
10 |
|
11 |
|
12 | if (args.includes('--esmodule')) {
|
13 | configs.push(createWebpackConfig('web', { module: true }))
|
14 | }
|
15 |
|
16 | console.log('\nCreating an optimized production build\n')
|
17 |
|
18 | webpack(configs).run((err, stats) => {
|
19 | if (err || stats.hasErrors()) {
|
20 | console.error(err || stats.hasErrors())
|
21 | }
|
22 | console.log(
|
23 | stats.toString({
|
24 | chunks: false,
|
25 | colors: true
|
26 | })
|
27 | )
|
28 |
|
29 | console.log('\nCompiled server and client successfully.\n')
|
30 |
|
31 | process.exit(0)
|
32 | })
|