Digital Office Automation System
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.

1 天之前
12345678910111213141516171819202122232425262728293031323334353637383940
  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 = 3062
  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(
  22. chalk.green(`> Preview at http://localhost:${port}${publicPath}`)
  23. )
  24. if (report) {
  25. console.log(
  26. chalk.green(
  27. `> Report at http://localhost:${port}${publicPath}report.html`
  28. )
  29. )
  30. }
  31. })
  32. } else {
  33. run(`vue-cli-service build ${args}`)
  34. }