Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storybook): allow NX_* environment variables #10061

Merged
merged 1 commit into from Jun 2, 2022

Conversation

puku0x
Copy link
Contributor

@puku0x puku0x commented Apr 29, 2022

Current Behavior

NX_* environment variables are not available in Storybook.

Storybook only allows STORYBOOK_* environment variables😕
https://storybook.js.org/docs/react/configure/environment-variables
https://github.com/storybookjs/storybook/blob/bdf9e5ed854b8d34e737eee1a4a05add88265e92/lib/core-common/src/utils/envs.ts#L23-L27

Expected Behavior

NX_* environment variables should be available.

Related Issue(s)

Fixes #

@nx-cloud
Copy link

nx-cloud bot commented Apr 29, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 23bae77. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 13 targets

Sent with 💌 from NxCloud.

@vercel
Copy link

vercel bot commented Apr 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
nx-dev ⬜️ Ignored (Inspect) Apr 29, 2022 at 0:39AM (UTC)

@puku0x puku0x force-pushed the fix-storybook-react-env-inject branch from f15cfbc to a5bb9a3 Compare April 29, 2022 12:30
@puku0x puku0x force-pushed the fix-storybook-react-env-inject branch from a5bb9a3 to 23bae77 Compare April 29, 2022 12:36
@puku0x puku0x changed the title fix(storybook): overwrite environment variables fix(storybook): allow NX_* environment variables Apr 29, 2022
@puku0x puku0x marked this pull request as ready for review May 2, 2022 08:06
@jaysoo jaysoo merged commit bb166a5 into nrwl:master Jun 2, 2022
@puku0x puku0x deleted the fix-storybook-react-env-inject branch June 8, 2022 09:05
// Grab NODE_ENV and NX_* and STORYBOOK_* environment variables and prepare them to be
// injected into the application via DefinePlugin in webpack configuration.
const NX_PREFIX = /^NX_/i;
const STORYBOOK_PREFIX = /^STORYBOOK__/i;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a double underscore here.

This has caused all my STORYBOOK variables to suddenly disappear.

According to the docs it's a single underscore required.

https://storybook.js.org/docs/react/configure/environment-variables

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaysoo FYI :)

@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants