vue.config.js
@@ -1,6 +1,7 @@
'use strict'
const path = require('path')
const defaultSettings = require('./src/settings.js')
const webpack = require('webpack')
function resolve(dir) {
  return path.join(__dirname, dir)
@@ -24,10 +25,23 @@
   * In most cases please use '/' !!!
   * Detail: https://cli.vuejs.org/config/#publicpath
   */
  publicPath: '/',
  publicPath: './',
  outputDir: 'dist',
  assetsDir: 'static',
  lintOnSave: process.env.NODE_ENV === 'development',
  // css: {
  //   loaderOptions: {
  //     css: {},
  //     postcss: {
  //       plugins: [
  //         require('postcss-px2rem')({
  //           remUnit: 192// /设计图宽度/10
  //         })
  //       ]
  //     }
  //   }
  // },
  transpileDependencies: ['screenfull'],
  productionSourceMap: false,
  devServer: {
    port: port,
@@ -36,7 +50,17 @@
      warnings: false,
      errors: true
    },
    before: require('./mock/mock-server.js')
    proxy: {
      [process.env.VUE_APP_BASE_API]: {
        target: 'http://121.196.36.24:8001', // 请求的第三⽅接⼝地址       本地开发服务器
        changeOrigin: true, // 请求跨域时,需 配置此项
        pathRewrite: { // 路径重写,替换target中的请求地址
          ['^' + process.env.VUE_APP_BASE_API]: '/api/'
        }
        // ws: true;//开启ws, 如果是http代理此处可以不用设置
      }
    }
    // before: require('./mock/mock-server.js')
  },
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
@@ -46,7 +70,21 @@
      alias: {
        '@': resolve('src')
      }
    }
    },
    plugins: [
      new webpack.ProvidePlugin({
        jQuery: 'jquery',
        $: 'jquery'
      })
    ]
    // module: {
    // rules: [
    //   {
    //     test: /.vue$/,
    //     loader: 'vue-loader'
    //   }
    // ]
    // }
  },
  chainWebpack(config) {
    // it can improve the speed of the first screen, it is recommended to turn on preload
@@ -87,7 +125,7 @@
            .plugin('ScriptExtHtmlWebpackPlugin')
            .after('html')
            .use('script-ext-html-webpack-plugin', [{
            // `runtime` must same as runtimeChunk name. default is `runtime`
              // `runtime` must same as runtimeChunk name. default is `runtime`
              inline: /runtime\..*\.js$/
            }])
            .end()