|
|
@@ -1,14 +1,27 @@
|
|
|
-import { fileURLToPath, URL } from 'node:url'
|
|
|
-
|
|
|
-import { defineConfig } from 'vite'
|
|
|
-import vue from '@vitejs/plugin-vue'
|
|
|
-
|
|
|
+import { fileURLToPath, URL } from "node:url";
|
|
|
+import { defineConfig, loadEnv } from "vite";
|
|
|
+import vue from "@vitejs/plugin-vue";
|
|
|
// https://vitejs.dev/config/
|
|
|
-export default defineConfig({
|
|
|
- plugins: [vue()],
|
|
|
- resolve: {
|
|
|
- alias: {
|
|
|
- '@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
- }
|
|
|
- }
|
|
|
-})
|
|
|
+export default defineConfig(({ mode }) => {
|
|
|
+ const env = loadEnv(mode, process.cwd());
|
|
|
+ console.log(env);
|
|
|
+ // const { VUE_APP_BASE_API } = env
|
|
|
+ return {
|
|
|
+ plugins: [vue()],
|
|
|
+ resolve: {
|
|
|
+ alias: {
|
|
|
+ "@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ server: {
|
|
|
+ port: 3000,
|
|
|
+ proxy: {
|
|
|
+ "/api/": {
|
|
|
+ target: env.VITE_APP_SERVER_URL,
|
|
|
+ changeOrigin: true,
|
|
|
+ rewrite: (path) => path.replace(/^\/api/, ""),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+});
|