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.

dotenv-expand breaking build when "$" is used

See original GitHub issue

We 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:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
gaearoncommented, Feb 9, 2018

Fixed in react-scripts@1.1.1.

1reaction
gaearoncommented, Feb 2, 2018

This sounds really annoying. Sorry.

Do you want to look into what’s causing this?

Read more comments on GitHub >

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

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