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.
46 lines
1.5 KiB
46 lines
1.5 KiB
9 months ago
|
// +----------------------------------------------------------------------
|
||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||
|
// +----------------------------------------------------------------------
|
||
|
|
||
|
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}`)
|
||
|
}
|