UNPKG

828 BJavaScriptView Raw
1const webpack = require('webpack')
2const createWebpackConfig = require('../src/config/createWebpackConfig')
3
4const args = process.argv.slice(2)
5
6const serverConfig = createWebpackConfig('node')
7const clientConfig = createWebpackConfig('web')
8
9const configs = [serverConfig, clientConfig]
10
11// create esmodule build
12if (args.includes('--esmodule')) {
13 configs.push(createWebpackConfig('web', { module: true }))
14}
15
16console.log('\nCreating an optimized production build\n')
17
18webpack(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, // Makes the build much quieter
25 colors: true // Shows colors in the console
26 })
27 )
28
29 console.log('\nCompiled server and client successfully.\n')
30
31 process.exit(0)
32})