diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..92d73b9 --- /dev/null +++ b/.env.development @@ -0,0 +1,2 @@ +# 开发环境配置 +VUE_APP_API_URL = '/api' diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..aa13e7f --- /dev/null +++ b/.env.production @@ -0,0 +1,3 @@ + +# 生产环境配置 +VUE_APP_API_URL = '/api' diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..314f5af --- /dev/null +++ b/vue.config.js @@ -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' 移除 + }, + }, + }, + }, +};