fix: 環境變數讀取
This commit is contained in:
+7
-4
@@ -1,10 +1,13 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import Vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
|
||||
return {
|
||||
plugins: [
|
||||
Vue({
|
||||
template: { transformAssetUrls },
|
||||
@@ -36,7 +39,7 @@ export default defineConfig({
|
||||
port: 3700,
|
||||
proxy:{
|
||||
"/service/": {
|
||||
target: process.env.VITE_PROXY_TARGET || "http://localhost:8080",
|
||||
target: env.VITE_PROXY_TARGET || "http://localhost:8080",
|
||||
changeOrigin: true,
|
||||
},
|
||||
}
|
||||
@@ -47,4 +50,4 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}})
|
||||
|
||||
Reference in New Issue
Block a user