3 changed files with 25 additions and 0 deletions
@ -0,0 +1,2 @@ |
|||||
|
# 开发环境配置 |
||||
|
VUE_APP_API_URL = '/api' |
@ -0,0 +1,3 @@ |
|||||
|
|
||||
|
# 生产环境配置 |
||||
|
VUE_APP_API_URL = '/api' |
@ -0,0 +1,20 @@ |
|||||
|
module.exports = { |
||||
|
configureWebpack: { |
||||
|
resolve: { |
||||
|
alias: { |
||||
|
'@src': require('path').resolve(__dirname, 'src'), // 配置别名 '@src' 指向 'src' 目录
|
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
devServer: { |
||||
|
proxy: { |
||||
|
'/api': { |
||||
|
target: 'http://localhost:3000', // 后端 API 地址
|
||||
|
changeOrigin: true, // 是否允许跨域
|
||||
|
pathRewrite: { |
||||
|
'^/api': '', // 重写路径,将 '/api' 移除
|
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
}; |
Loading…
Reference in new issue