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.

A way to define custom environment variables

See original GitHub issue

This may be a tiny yet non-obtrusive solution. Allow a custom .env.js file that exports a key value pair used for custom webpack defines. I guess this wont be useful for many, since you any way get to refer to NODE_ENV but I also used this for defining a publicPath from an environment variable or defaulting to root. (useful for me as i had to run the same app for multiple quizzes, so I could build the frontend without configuring anything and having sane default not-get-in-the-way configs while development and testing)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:60 (32 by maintainers)

github_iconTop GitHub Comments

61reactions
dmi3ycommented, Jul 23, 2016

I might have one. Let’s say there is api server running at different enviroments like so:

  • dev.api.foobar.com
  • prod.api.foobar.com

And I’m building SPA which supposed to use CORS and being hosted anywhere, just like static site.

And such I want to supply dev/prod absolute paths for different versions of SPA.

Hope this makes sense.

49reactions
mxstbrcommented, Jul 23, 2016

I think at that point you have a very advanced use case and ejecting is the way to go. I don’t think adding .env support by default is really necessary, since most users will never need it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create Custom Environment Variables in Windows
By defining and setting up your own custom environment variables, you can create direct paths and shortcuts to apps, directories, URLs and more ......
Read more >
7. Add custom environment variables - Devilbox documentation
7.1. Add custom environment variables¶ ... This is fairly simple. Any variable inside the .env file is considered an environment variable and automatically...
Read more >
How To Create Custom Environment Variables In Windows 10
Type in sysdm.cpl in Run to open System Properties. · From the System Properties window, switch to the Advanced tab and then click...
Read more >
How to Define Custom ENV Variables in Laravel? - DevDojo
A way to define environment variables in Linux would be to use the export command followed by the variable that you want to...
Read more >
Adding Custom Environment Variables | Create React App
Environment variables are embedded into the build, meaning anyone can view them by inspecting your app's files. The environment variables are ...
Read more >

github_iconTop Related Medium Post

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