Nenhuma Descrição

build.js 953B

123456789101112131415161718192021222324252627282930313233343536
  1. require('./check-versions')()
  2. process.env.NODE_ENV = 'production'
  3. var ora = require('ora')
  4. var rm = require('rimraf')
  5. var path = require('path')
  6. var chalk = require('chalk')
  7. var webpack = require('webpack')
  8. var config = require('../config')
  9. var webpackConfig = require('./webpack.prod.conf')
  10. var spinner = ora('building for production...')
  11. spinner.start()
  12. rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
  13. if (err) throw err
  14. webpack(webpackConfig, function (err, stats) {
  15. spinner.stop()
  16. if (err) throw err
  17. process.stdout.write(stats.toString({
  18. colors: true,
  19. modules: false,
  20. children: false,
  21. chunks: false,
  22. chunkModules: false
  23. }) + '\n\n')
  24. console.log(chalk.cyan(' Build complete.\n'))
  25. console.log(chalk.yellow(
  26. ' Tip: built files are meant to be served over an HTTP server.\n' +
  27. ' Opening index.html over file:// won\'t work.\n'
  28. ))
  29. })
  30. })