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, `../public/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'); rm(path.join(distDir, './static'), rmerr => { if (err) { throw rmerr; } 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'); }); }); }); });