2 require('./check-versions')()
4 process.env.NODE_ENV = 'production'
6 const ora = require('ora')
7 const rm = require('rimraf')
8 const path = require('path')
9 const chalk = require('chalk')
10 const webpack = require('webpack')
11 const config = require('../config')
12 const webpackConfig = require('./webpack.prod.conf')
14 const spinner = ora('building for production...')
17 rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
19 webpack(webpackConfig, (err, stats) => {
22 process.stdout.write(stats.toString({
25 children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
30 if (stats.hasErrors()) {
31 console.log(chalk.red(' Build failed with errors.\n'))
35 console.log(chalk.cyan(' Build complete.\n'))
36 console.log(chalk.yellow(
37 ' Tip: built files are meant to be served over an HTTP server.\n' +
38 ' Opening index.html over file:// won\'t work.\n'