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'
5
5
6
6
export default defineConfig ( ( { mode } ) => {
7
7
// 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
+ } )
10
17
11
18
return {
12
19
plugins : [ vue ( ) ] ,
@@ -53,7 +60,7 @@ export default defineConfig(({ mode }) => {
53
60
} ,
54
61
define : {
55
62
// vitejs does not support process.env so we have to redefine it
56
- 'process.env' : process . env ,
63
+ 'process.env' : env ,
57
64
} ,
58
65
}
59
66
} )
You can’t perform that action at this time.
0 commit comments