vue.config.js 812 字节
Newer Older
!阳仔's avatar
!阳仔 已提交
1 2 3
const { defineConfig } = require('@vue/cli-service')
const path = require('path');
function resolve(dir){
ylwdev's avatar
ylwdev 已提交
4
  return path.join(__dirname,dir)//设置绝对路径
!阳仔's avatar
!阳仔 已提交
5 6 7 8
}
let publicPath = '/'
if (process.env.NODE_ENV === 'production') {
  publicPath = 'https://csdn.gitcode.host/csdn-datav/'
ylwdev's avatar
ylwdev 已提交
9
}
!阳仔's avatar
!阳仔 已提交
10 11 12 13 14 15
module.exports = defineConfig({
  assetsDir: 'csdn-datav',
  transpileDependencies: true,
  lintOnSave:false,
  publicPath:publicPath,
  devServer: {
ylwdev's avatar
ylwdev 已提交
16 17
    allowedHosts:'all',
    host: 'loc.csdn.net',
!阳仔's avatar
!阳仔 已提交
18 19 20 21
    headers: {
      'Access-Control-Allow-Origin': '*'
    }
  },
ylwdev's avatar
ylwdev 已提交
22 23 24 25 26 27 28
  // devServer: {
  //   allowedHosts:'all',
  //   port: '3000',
  //   headers: {
  //     'Access-Control-Allow-Origin': '*'
  //   }
  // },
!阳仔's avatar
!阳仔 已提交
29 30 31 32 33
  productionSourceMap: false,
  chainWebpack: config => {
    config.resolve.alias.set('@', resolve('src'))
  }
})