chromaui/addon-visual-tests

NODE_ENV option

Closed this issue · 2 comments

Describe the bug

My storybook renders well when NODE_ENV is development, but it fails when it's production. (Mock functions obviously don't work in the production mode). There is option for NODE_ENV in the GitHub action: STORYBOOK_NODE_ENV, but I don't see any mentions of such option for the addon. an

To reproduce

Just try to write a storybook that fails in production mode (throw an error, for example, depends on NODE_ENV).

Environment

Node v18.17.1

I've also had this issue and I fixed it by changing the build command for storybook in my package.json:

{
  "scripts": {
    "build-storybook": "NODE_ENV=development storybook build -o build/storybook/",
  }
}

Chromatic seemed to respect that.

Awesome, it works! Thank you @rChaoz!