微小悟公众号管理系统

build.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 utils = require('./utils')
  9. var config = require('../config')
  10. var webpackConfig = require('./webpack.prod.conf')
  11. utils.copyright()
  12. utils.clog('blue',`
  13. 项目构建中 [配置:${process.env.API_ENV}]
  14. `)
  15. var spinner = ora('请稍等...')
  16. spinner.start()
  17. rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
  18. if (err) throw err
  19. webpack(webpackConfig, function (err, stats) {
  20. spinner.stop()
  21. if (err) throw err
  22. process.stdout.write(stats.toString({
  23. colors: true,
  24. modules: false,
  25. children: false,
  26. chunks: false,
  27. chunkModules: false
  28. }) + '\n\n')
  29. utils.clog('blue','==== ♥ 构建完成 ♥ ====\n')
  30. // console.log(chalk.yellow(
  31. // ' Tip: built files are meant to be served over an HTTP server.\n' +
  32. // ' Opening index.html over file:// won\'t work.\n'
  33. // ))
  34. })
  35. })