Browse Source

build

master
占永辉 4 years ago
parent
commit
57a161ea62
  1. 1
      .gitignore
  2. 35
      build/index.js
  3. 1
      package.json

1
.gitignore vendored

@ -21,6 +21,5 @@ selenium-debug.log
*.sln
*.local
admin-web
build

35
build/index.js

@ -0,0 +1,35 @@
const { run } = require('runjs')
const chalk = require('chalk')
const config = require('../vue.config.js')
const rawArgv = process.argv.slice(2)
const args = rawArgv.join(' ')
if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
const report = rawArgv.includes('--report')
run(`vue-cli-service build ${args}`)
const port = 9526
const publicPath = config.publicPath
var connect = require('connect')
var serveStatic = require('serve-static')
const app = connect()
app.use(
publicPath,
serveStatic('./dist', {
index: ['index.html', '/']
})
)
app.listen(port, function () {
console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`))
if (report) {
console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
}
})
} else {
run(`vue-cli-service build ${args}`)
}

1
package.json

@ -6,6 +6,7 @@
"license": "Apache 2.0",
"scripts": {
"dev": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"build:prod": "vue-cli-service build",
"build:boot": "vue-cli-service build --mode boot",
"build:docker": "vue-cli-service build --mode docker",

Loading…
Cancel
Save