After upgrading from 4.0.0-alpha.24 to 4.0.0-rc.1 storybook stopped loading .env file.
I'm using CRA and there is NODE_PATH variable that is needed to compile source.
I've solved the problem by adding env $(cat .env) to the storybook scripts in package.json, but could someone please tell is that a bug or a feature? Will storybook support .env file in the future?
Sorry, I've not found any info in the documentation... (
@pksunkara , @ndelangen , could it be related to the recent env loading changes ?
Possibly. But loading from .env is working as we have chromatic based tests for this.
@pksunkara It's weird :(
@pksunkara @igor-dv
I've created test repo from scratch
https://github.com/vadzim/test-storybook
npx create-react-app test-storybookcd test-storybooknpx -p @storybook/cli@rc sb init.env with NODE_PATH=./srcApp.js to import files from src without './'App.js to storybookyarn start works as expected
yarn storybook does not work
env $(cat .env) yarn storybook runs storybook
@vadzim-revolist Have you tried this with anything other then NODE_PATH?
@ndelangen I've tried just now.
Actually it reads .env file and passes all the content of it into storybook js, even NODE_PATH, but does not use NODE_PATH from .env to build storybook itself.
If I set NODE_PATH from command line like NODE_PATH=src yarn storybook then it works.
On rc-3 this error still present
I see.
Thank you for testing, I now understand the problem better.
Related discussion, https://github.com/facebook/create-react-app/issues/2230