Update index.js
This commit is contained in:
		| @@ -1,16 +1,15 @@ | |||||||
| const { sh } = require('tasksfile') | const { sh } = require('tasksfile') | ||||||
| const chalk = require('chalk') |  | ||||||
| const config = require('../vue.config.js') |  | ||||||
| const rawArgv = process.argv.slice(2) | const rawArgv = process.argv.slice(2) | ||||||
| const args = rawArgv.join(' ') | const args = rawArgv.join(' ') | ||||||
|  |  | ||||||
| sh(`vue-cli-service build ${args}`) | sh(`vue-cli-service build ${args}`) | ||||||
|  |  | ||||||
| if (process.env.npm_config_preview || rawArgv.includes('--preview')) { | if (process.env.npm_config_preview || rawArgv.includes('--preview')) { | ||||||
|  |   const config = require('../vue.config.js') | ||||||
|   const publicPath = config.publicPath |   const publicPath = config.publicPath | ||||||
|  |  | ||||||
|   var connect = require('connect') |   const connect = require('connect') | ||||||
|   var serveStatic = require('serve-static') |   const serveStatic = require('serve-static') | ||||||
|   const app = connect() |   const app = connect() | ||||||
|  |  | ||||||
|   app.use( |   app.use( | ||||||
| @@ -22,12 +21,11 @@ if (process.env.npm_config_preview || rawArgv.includes('--preview')) { | |||||||
|  |  | ||||||
|   const port = 9526 |   const port = 9526 | ||||||
|   app.listen(port, function() { |   app.listen(port, function() { | ||||||
|  |     const chalk = require('chalk') | ||||||
|     console.log(chalk.green(`> Preview at  http://localhost:${port}${publicPath}`)) |     console.log(chalk.green(`> Preview at  http://localhost:${port}${publicPath}`)) | ||||||
|  |  | ||||||
|     const isWithReport = rawArgv.includes('--report') |     if (rawArgv.includes('--report')) { | ||||||
|     if (isWithReport) { |  | ||||||
|       console.log(chalk.green(`> Report at  http://localhost:${port}${publicPath}report.html`)) |       console.log(chalk.green(`> Report at  http://localhost:${port}${publicPath}report.html`)) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   }) |   }) | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user