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.

process.env (or other globals) support

See original GitHub issue

Node, Webpack and React communities adopted the use of process.env to setup build time variables.

Examples:

process.env.PUBLIC_URL = 'https://react-something.stackblitz.io'
process.env.NODE_ENV = 'production'

Is there a way to configure those automatically?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
golearycommented, May 25, 2021

I see, thanks!

This is where I initially looked to see if I could set them: image

Perhaps an “Environment Config” section that enables setting env variables?

2reactions
diarmuidoconnorcommented, Mar 30, 2022

Hi, Concerning the declaration of custom environment variables, I require to declare an API key value for a React app. When using the create-react-app tool on localhost, the typical solution is to use the .env file. This approach does not work on the template React app environment created by Stackblitz, which uses the EngineBlock model (as opposed to Web Container), as I understand it. When running on localhost, the keys declared in .env are accessed by a React component using the process.env object. This object is also present in the StackBlitz environment and has one default property, NODE_ENV. However, any variables declared in .env are not added to process.env.

Has anyone come up with a workaround for this problem? Tks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js: How does process.env differ from global?
Both process and globals are globally accessible variables in node. Attaching thing to either just means that thing is attached to different ...
Read more >
process.env: What it is and why/when/how to use it effectively
The process.env global variable is injected by the Node at runtime for your application to use and it represents the state of the...
Read more >
Working with Environment Variables in Node.js - Twilio
Environment variables are a great way to configure parts of your Node.js ... by creating an env object within the process global object....
Read more >
Node Environment Variables: Process env Node
In Node.js, process.env is a global variable injected during runtime. It is a view of the state of the system environment variables. When...
Read more >
How to Use Environment Variables the Right Way
How could environment variables be a bad thing if they help us write more ... As developers, we all know how bad global...
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