Files
xiaozhi-esp32-server/main/manager-web/vue.config.js
T

33 lines
873 B
JavaScript
Raw Normal View History

2025-03-12 13:38:44 +08:00
const { defineConfig } = require('@vue/cli-service');
const dotenv = require('dotenv');
2025-03-12 23:31:59 +08:00
// 确保加载 .env 文件
2025-03-12 13:38:44 +08:00
dotenv.config();
console.log("base_url",process.env.VUE_APP_API_BASE_URL);
2025-03-12 13:38:44 +08:00
module.exports = defineConfig({
chainWebpack: config => {
config.plugin('html')
.tap(args => {
// 将 VUE_APP_TITLE 从环境变量中注入到 HTML 中
args[0].title = process.env.VUE_APP_TITLE || '小智-智控台';
return args;
});
},
devServer: {
port: 8001, // 指定端口为 8001
proxy: {
'/xiaozhi-esp32-api': {
target: process.env.VUE_APP_API_BASE_URL, // 后端 API 的基础 URL
changeOrigin: true, // 允许跨域
pathRewrite: {
'^/api': '', // 路径重写
2025-03-12 23:31:59 +08:00
},
2025-03-12 13:38:44 +08:00
},
},
client: {
overlay: false, // 不显示 webpack 错误覆盖层
},
},
2025-03-12 23:31:59 +08:00
});