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

process.env.STORYBOOK is no longer true #17439

Closed
RyanMacBern opened this issue Feb 7, 2022 · 2 comments
Closed

process.env.STORYBOOK is no longer true #17439

RyanMacBern opened this issue Feb 7, 2022 · 2 comments

Comments

@RyanMacBern
Copy link

Describe the bug
I depend on the process.env.STORYBOOK being true to to setup the environment properly for Storybook. After upgrading from 6.4.9 to 6.4.18 the value is no longer true and Storybook fails to run for my setup.

To Reproduce
Please create a reproduction by running npx sb@next repro and following the instructions. Read our documentation to learn more about creating reproductions.
Paste your repository and deployed reproduction here. We prioritize issues with reproductions over those without.

System
System:
OS: macOS 12.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
npm: 8.1.4 - ~/.nvm/versions/node/v16.13.0/bin/npm
Browsers:
Chrome: 98.0.4758.80
Firefox: 96.0.3
Safari: 15.2
npmPackages:
@storybook/addon-actions: 6.4.18 => 6.4.18
@storybook/addon-essentials: 6.4.18 => 6.4.18
@storybook/addon-interactions: ^6.4.18 => 6.4.18
@storybook/addon-links: 6.4.18 => 6.4.18
@storybook/addon-storyshots: 6.4.18 => 6.4.18
@storybook/addons: 6.4.18 => 6.4.18
@storybook/node-logger: 6.4.18 => 6.4.18
@storybook/preset-create-react-app: ^3.1.5 => 3.2.0
@storybook/react: 6.4.18 => 6.4.18
@storybook/testing-library: ^0.0.9 => 0.0.9

Additional context
Add any other context about the problem here.

@shilman
Copy link
Member

shilman commented Feb 8, 2022

I can't reproduce? Are you referring to it as process.env.STORYBOOK? Is this in dev mode or static build?

Can you share a reproduction? See how to create a repro. If so, I'd be happy to take a look. Thanks!

@RyanMacBern
Copy link
Author

@shilman

Turns out it's a Webpack 5 issue. We upgraded to Webpack 5 which no longer includes a polyfill for destructuring multiple values from process.env. See webpack/webpack#14800.

I worked around it by changing from this:

const { STORYBOOK } = process.env || {};

to this:

const STORYBOOK = process.env.STORYBOOK;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants