dotenv-expand breaking build when "$" is used
See original GitHub issueWe use variables that include $
within the strings, which we don’t want to be expanded. Escaping with \$
works fine when it occurs at the start of the string, but not anywhere else within the string.
Example:
REACT_APP_MYVAR=\$bar.baz
<- works as expected, value is "$bar.baz"
REACT_APP_MYVAR=foo\$bar.baz
<- I’d expect "foo$bar.baz"
but I get "foo\.baz"
I also tried working around the problem, like so:
BAR=\$bar
REACT_APP_MYVAR=foo$BAR.baz
But it gave the same result of "foo\.baz"
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
dotenv - npm
Create a .env file in the root of your project: ... This is a breaking change from >= v15.0.0 and on. ... Use...
Read more >Dotenv issues/error with create-react-app react-scripts
It seems dotenv should only be used in backend application like nodejs and not frontend apps like react. When the error came up, ......
Read more >Serverless Dotenv Plugin
Preload function environment variables into Serverless. Use this plugin if you have variables stored in a .env file that you want loaded into...
Read more >Env Variables and Modes - Vite
Also, Vite uses dotenv-expand to expand variables out of the box. To learn more about the syntax, check out their docs. Note that...
Read more >Understanding React Native env variables - LogRocket Blog
Learn how to create and use env variables in React Native. ... Hiding your API key; Expanding env variables already in your application ......
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
Fixed in
react-scripts@1.1.1
.This sounds really annoying. Sorry.
Do you want to look into what’s causing this?