2

I would like to ask if what's wrong with the dollar sign within the environment variable? I tried to do everything to fix the problem I've encountered using env-cmd package from npm with react

Sample

.env.development

REACT_SECRET_CODE=$B&FG%@(*4Fgawq@)

After a few hours of debugging then until I've noticed that it removes the $ sign from the example env variable REACT_SECRET_CODE then the variable shown in the console log is &FG%@(*4Fgawq@) instead of $B&FG%@(*4Fgawq@)

Antolin Bernas
  • 182
  • 3
  • 9

1 Answers1

1

Simply escaping the dollar sign will solve the issue.

The reason this has to be done is because otherwise, for $B, env-cmd will try to perform variable substitution on the variable B, which is empty and will resolve to an empty string.

Filip Kaštovský
  • 1,866
  • 8
  • 12