synclounge/build/build.js

36 lines
1023 B
JavaScript
Raw Normal View History

2017-06-11 19:06:34 +00:00
require('./check-versions')()
process.env.NODE_ENV = 'production'
2017-04-07 05:09:03 +00:00
var ora = require('ora')
2017-06-11 19:06:34 +00:00
var rm = require('rimraf')
var path = require('path')
var chalk = require('chalk')
2017-04-07 05:09:03 +00:00
var webpack = require('webpack')
2017-06-11 19:06:34 +00:00
var config = require('../config')
2017-04-07 05:09:03 +00:00
var webpackConfig = require('./webpack.prod.conf')
var spinner = ora('building for production...')
spinner.start()
2017-06-11 19:06:34 +00:00
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
2018-07-20 04:31:44 +00:00
webpack(webpackConfig, function (err, stats) {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n\n')
2017-06-11 19:06:34 +00:00
2018-07-20 04:31:44 +00:00
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
2017-06-11 19:06:34 +00:00
' Opening index.html over file:// won\'t work.\n'
2018-07-20 04:31:44 +00:00
))
})
2017-04-07 05:09:03 +00:00
})