Rap 原分销系统代码Web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
892B

  1. const { run } = require('runjs')
  2. const chalk = require('chalk')
  3. const config = require('../vue.config.js')
  4. const rawArgv = process.argv.slice(2)
  5. const args = rawArgv.join(' ')
  6. if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
  7. const report = rawArgv.includes('--report')
  8. run(`vue-cli-service build ${args}`)
  9. const port = 9526
  10. const publicPath = config.publicPath
  11. var connect = require('connect')
  12. var serveStatic = require('serve-static')
  13. const app = connect()
  14. app.use(
  15. publicPath,
  16. serveStatic('./dist', {
  17. index: ['index.html', '/']
  18. })
  19. )
  20. app.listen(port, function () {
  21. console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`))
  22. if (report) {
  23. console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
  24. }
  25. })
  26. } else {
  27. run(`vue-cli-service build ${args}`)
  28. }