File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,15 @@ import autoprefixer from 'autoprefixer'
55
66export default defineConfig ( ( { mode } ) => {
77 // Load .env
8- const env = loadEnv ( mode , process . cwd ( ) , '' )
9- process . env = { ...process . env , ...env }
8+ const viteEnv = loadEnv ( mode , process . cwd ( ) , '' )
9+ const env = { }
10+
11+ // Filter env to variables starting with VITE_APP or VUE_APP
12+ Object . keys ( { ...process . env , ...viteEnv } ) . forEach ( key => {
13+ if ( key . startsWith ( 'VITE_APP' ) || key . startsWith ( 'VUE_APP' ) ) {
14+ env [ key ] = viteEnv [ key ]
15+ }
16+ } )
1017
1118 return {
1219 plugins : [ vue ( ) ] ,
@@ -53,7 +60,7 @@ export default defineConfig(({ mode }) => {
5360 } ,
5461 define : {
5562 // vitejs does not support process.env so we have to redefine it
56- 'process.env' : process . env ,
63+ 'process.env' : env ,
5764 } ,
5865 }
5966} )
You can’t perform that action at this time.
0 commit comments