love-nav-vue/vue.config.js
2023-12-26 22:37:41 +08:00

71 lines
1.9 KiB
JavaScript

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