const path = require('path')
const packageInfo = require('./package.json');
const resolve = dir => {
return path.join(__dirname, dir)
}
module.exports = {
// Project deployment base
// By default we assume your app will be deployed at the root of a domain,
// e.g. https://www.my-app.com/
// If your app is deployed at a sub-path, you will need to specify that
// sub-path here. For example, if your app is deployed at
// https://www.foobar.com/my-app/
// then change this to '/my-app/'
// tweak internal webpack configuration.
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
// 如果你不需要使用eslint,把lintOnSave设为false即可
outputDir:'D:\\share\\NP-Client\\nginx\\html\\shenyang',
lintOnSave: true,
configureWebpack: config => {
config.module.unknownContextCritical = false
},
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
},
css:{ // 注入less全局变量
loaderOptions:{
less: {
lessOptions:{javascriptEnabled:true},
additionalData:`@import "~@/assets/variables.less";`
}
}
},
// 设为false打包时不生成.map文件
productionSourceMap: false,
devServer: {
disableHostCheck: true, // 解决“Invalid Host header”问题
proxy: { // 跨域设置
'/api/': {
target: process.env.VUE_APP_PROXY_URL,
changeOrigin: true
}
}
},
pages: { // 头部加入版本号
index: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html',
chunks: ['chunk-vendors', 'chunk-common', 'index'],
meta: {version: `${packageInfo.version}`}
},
}
}