123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- const { run } = require('runjs')
- const chalk = require('chalk')
- const config = require('../vue.config.js')
- const webpack = require('webpack')
- 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()
- resolve: {
- extensions: ['.js', '.vue', '.json'],
- alias: {
- 'vue$':"vue/dist/vue.esm.js",
- '@': resolve('src'),
- 'jquery':'jquery'
- }
- }
- 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}`)
- }
- plugins:[
- new webpack.ProvidePlugin({
- jQuery:"jquery",
- $:"jquery",
- 'windows.jQuery':"jquery"
- })
- ]
|