We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b27210b commit 9c9d05eCopy full SHA for 9c9d05e
examples/vite/vite.config.ts
@@ -1,7 +1,16 @@
1
-import { defineConfig } from 'vite';
+import { defineConfig, loadEnv } from 'vite';
2
import react from '@vitejs/plugin-react-swc';
3
4
// https://vitejs.dev/config/
5
-export default defineConfig({
6
- plugins: [react()],
+export default defineConfig(() => {
+ const rootDir = process.cwd();
7
+
8
+ // Load shared .env file
9
+ const env = loadEnv('', rootDir, '');
10
+ return {
11
+ plugins: [react()],
12
+ define: {
13
+ 'process.env': env, // need `process.env` access
14
+ },
15
+ };
16
});
0 commit comments