Skip to content

Commit 9aedc29

Browse files
docs: Update environment-variables.md with info about env.DEV (#1630)
Co-authored-by: Aaron <[email protected]>
1 parent e1f3d75 commit 9aedc29

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/guide/essentials/config/environment-variables.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ To use environment variables in the manifest, you need to use the function synta
6565

6666
```ts
6767
export default defineConfig({
68-
extensionApi: 'chrome',
6968
modules: ['@wxt-dev/module-vue'],
7069
manifest: { // [!code --]
7170
oauth2: { // [!code --]
@@ -81,3 +80,16 @@ export default defineConfig({
8180
```
8281

8382
WXT can't load your `.env` files until after the config file has been loaded. So by using the function syntax for `manifest`, it defers creating the object until after the `.env` files are loaded into the process.
83+
84+
Note that Vite's runtime environment variables, like `import.meta.env.DEV`, will not be defined. Instead, access the `mode` like this:
85+
86+
```ts
87+
export default defineConfig({
88+
manifest: ({ mode }) => {
89+
const isDev = mode === 'development';
90+
console.log('Is development mode:', isDev);
91+
92+
// ...
93+
},
94+
});
95+
```

0 commit comments

Comments
 (0)