question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `import.meta.env`

See original GitHub issue

Feature 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:open
  • Created a year ago
  • Reactions:1
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
JounQincommented, Aug 31, 2022

I’m like to have a more standard way because process is not standard global variable.

2reactions
alexander-akaitcommented, May 18, 2022

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 in import.meta.env, also using globalThis 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found