loulijun2021
2022-07-04 991a63234bba49da5a22d0f64ae15837d3253829
vue.config.js
@@ -1,7 +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 +24,22 @@
   * 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
  //         })
  //       ]
  //     }
  //   }
  // },
  productionSourceMap: false,
  devServer: {
    port: port,
@@ -36,7 +48,16 @@
      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/'
        }
      }
    }
    // before: require('./mock/mock-server.js')
  },
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
@@ -46,7 +67,13 @@
      alias: {
        '@': resolve('src')
      }
    }
    },
    plugins: [
      new webpack.ProvidePlugin({
        jQuery: 'jquery',
        $: 'jquery'
      })
    ]
  },
  chainWebpack(config) {
    // it can improve the speed of the first screen, it is recommended to turn on preload