Support `import.meta.env`
See original GitHub issueFeature request
What is the expected behavior?
import.meta.env.NODE_ENV
What is motivation or use case for adding/changing the behavior?
migrate process.env.NODE_ENV
How should this be implemented in your opinion?
No idea
Are you willing to work on this yourself?
No idea
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:12 (9 by maintainers)
Top Results From Across the Web
Env Variables and Modes
Vite exposes env variables on the special import.meta.env object. Some built-in variables are available in all cases: import.meta.env.
Read more >Import-meta-env | Startup/Runtime environment variables ...
Import -meta-env automatically generates types for your environment variables by using the .env.example file as a source of type information. Framework Agnostic.
Read more >import.meta - JavaScript - MDN Web Docs
The import.meta object is created by the host environment, ... The ES module implementation in Node.js supports resolving module specifiers ...
Read more >rollup-plugin-import-meta-env
The plugin exposes env variables on the special import.meta.env object. Config. env({ PROD: true, ...
Read more >Typescript Types for import.meta.env - vue.js
I am now using a framework (vite) that injects environment variables into import.meta.env .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m like to have a more standard way because
process
is not standard global variable.To be honestly I am always thinking what we should use
globalThis
to check env, i.e.globalThis.ENV
/globalThis.NODE_ENV
/etc ,import.meta
only for import meta and functions related to import (hot replacement/resolving/etc), not sure why we should store env inimport.meta.env
, also usingglobalThis
is solution for any platform - browser/node/deno,import.meta.env
only for bundlers, and you need again using bundler to change it, just my option