You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But, if I add a console.log(process.env), an empty object appears. The same happens if I console.log it inside any Story. In the main.ts file, consoling config gives me the right vars.
The issue is that the internal DefinePlugin in Webpack only replaces process.env.<KEY> by its corresponding value and leaves process.env untouched. This is for security reasons, and second, we will try to reduce the bloat in the output.
What you can do now and try is to adjust your code a little bit so that the const environmentVariables lists all keys individually:
Describe the bug
For technical reasons, I need to pass some environment variables to a Provider, configured in
preview.tsx
decorators.But, if I add a
console.log(process.env)
, an empty object appears. The same happens if Iconsole.log
it inside any Story. In themain.ts
file, consolingconfig
gives me the right vars.What am I doing wrong?
To Reproduce
Repro.
.env
file with two vars, one withSTORYBOOK_
prefix, the other without.preview.ts
topreview.tsx
and importedReact
main.ts
, I added:Button.stories.ts
, I added aconsole.log(process.env)
that returns{ }
(I tested in Stackblitz and in a local repro)
System
Additional context
No response
The text was updated successfully, but these errors were encountered: