65 lines
2.0 KiB
JavaScript
65 lines
2.0 KiB
JavaScript
const webpack = require('webpack')
|
|
const path = require('path')
|
|
|
|
function resolve(dir) {
|
|
return path.join(__dirname, dir)
|
|
}
|
|
|
|
module.exports = {
|
|
lintOnSave: false,
|
|
publicPath: "./", //配置打包之后的相对路径
|
|
devServer: {
|
|
open: true, // npm run serve后自动打开页面
|
|
// host: 'localhost',
|
|
port: 8080, // 开发服务器运行端口号
|
|
overlay: {
|
|
warnings: false,
|
|
errors: true
|
|
},
|
|
proxy: { //配置代理
|
|
"/api": {
|
|
// target: "http://192.168.0.52:86", // 本地
|
|
// target: "http://192.168.99.5:8093", // 本地
|
|
// target: "http://43.138.23.240:82", // 本地//
|
|
// target: "http://192.168.202.67:86", // 本地//
|
|
target: 'http://warehouse.chutang66.com/',
|
|
// target: 'http://world.dev.chutang66.com/',
|
|
changeOrigin: true, //开启代理
|
|
pathRewrite: { // 重命名
|
|
"^/api": "api"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
chainWebpack: (config) => {
|
|
config.resolve.alias
|
|
.set('@', resolve('src'))
|
|
.set('api', resolve('src/api'))
|
|
.set('components', resolve('src/components'))
|
|
.set('views', resolve('src/views'))
|
|
config.plugin('provide').use(webpack.ProvidePlugin, [{
|
|
$: 'jquery',
|
|
jquery: 'jquery',
|
|
jQuery: 'jquery',
|
|
'window.jQuery': 'jquery'
|
|
}])
|
|
config.plugin('define').tap((definitions) => {
|
|
Object.assign(definitions[0], {
|
|
__VUE_OPTIONS_API__: 'true',
|
|
__VUE_PROD_DEVTOOLS__: 'false',
|
|
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false'
|
|
})
|
|
return definitions
|
|
})
|
|
},
|
|
configureWebpack: () => {
|
|
var obj = {
|
|
externals: {
|
|
'./cptable': 'var cptable',
|
|
'../xlsx.js': 'var _XLSX'
|
|
}
|
|
};
|
|
return obj
|
|
},
|
|
}
|