love-nav-vue/vue.config.js

62 lines
1.6 KiB
JavaScript
Raw Normal View History

2023-12-20 18:30:11 +08:00
const { defineConfig } = require('@vue/cli-service')
2023-12-25 01:49:59 +08:00
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
2023-12-20 18:30:11 +08:00
module.exports = defineConfig({
transpileDependencies: true,
2023-12-20 22:45:32 +08:00
lintOnSave:false,//关闭语法检查
2023-12-25 01:49:59 +08:00
configureWebpack: {
plugins: [new NodePolyfillPlugin()],
resolve: { fallback: { fs: false } }
},
2023-12-20 18:30:11 +08:00
devServer: {
client: {
overlay: false // 编译错误时,取消全屏覆盖
},
2023-12-22 14:10:44 +08:00
open: true, //配置自动启动浏览器
host: "localhost",
https: false,
port: 8081,
2023-12-20 18:30:11 +08:00
proxy: {
'/api': {
//后端接口的baseurl
2023-12-22 22:57:37 +08:00
target: 'http://localhost:8080',
2023-12-20 18:30:11 +08:00
//是否允许跨域
changeOrigin: true,
// ws: true, //是否代理 websockets
// secure: true,
// 'secure': true,
headers: {
2023-12-22 22:57:37 +08:00
Connection: "kepp-alive",
'Access-Control-Allow-Origin': '*',
"Content-Type": "application/json;charset=utf-8"
2023-12-20 18:30:11 +08:00
},
pathRewrite: {
//这里的作用是使用去掉api
'^/api': ''
}
},
2023-12-22 22:57:37 +08:00
2023-12-22 14:10:44 +08:00
'/dev': {
//后端接口的baseurl
2023-12-23 18:01:51 +08:00
target: 'https://tenapi.cn/v2',
2023-12-22 14:10:44 +08:00
//是否允许跨域
changeOrigin: true,
// ws: true, //是否代理 websockets
// secure: true,
// 'secure': true,
headers: {
2023-12-23 18:01:51 +08:00
Connection: "kepp-alive",
'Access-Control-Allow-Origin': '*',
"Content-Type": "application/json;charset=utf-8"
2023-12-22 14:10:44 +08:00
},
pathRewrite: {
//这里的作用是使用去掉api
'^/dev': ''
}
},
2023-12-20 18:30:11 +08:00
}
}
})