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
It is using dotenv-webpack without reading env vars (not setting systemvars flag) to add process.env.xxx to DefinePlugin
It is also using its own mechanism to load env from .env and process.env and populate process.env using DefinePlugin
貴圈真亂
This is why it's not breaking local storybook build, only occurs in Docker builds, where there is no .env file.
Proposed fix
There are multiple ways to fix:
Copy .env.sample to .env in Dockerfile before build-storybook
Pros: easy to achieve
Cons: due to how storybook handles process.env and process.env.XXX, this may cause weird inconsistency in the two DefinePlugin.
Result webpack config (using --debug-webpack flag):
2. Write `LOCALE` to `.env` file in Dockerfile before `build-storybook`
- Pros: contents of both `process.env` and `process.env.XXX` will be consistent, since they are all reading from .env file
- Cons: we must add manually for each env vars to add to storybook build
The text was updated successfully, but these errors were encountered:
See:
https://dev.cofacts.org/storybook/index.html?path=/story/*
Root cause
TimeInfo
to the storybook. It requiresprocess.env.LOCALE
.STORYBOOK_
prefix.env
file during builddotenv-webpack
without reading env vars (not settingsystemvars
flag) to addprocess.env.xxx
toDefinePlugin
.env
andprocess.env
and populateprocess.env
usingDefinePlugin
Proposed fix
There are multiple ways to fix:
.env.sample
to.env
in Dockerfile beforebuild-storybook
process.env
andprocess.env.XXX
, this may cause weird inconsistency in the twoDefinePlugin
.--debug-webpack
flag):
2. Write `LOCALE` to `.env` file in Dockerfile before `build-storybook` - Pros: contents of both `process.env` and `process.env.XXX` will be consistent, since they are all reading from .env file - Cons: we must add manually for each env vars to add to storybook buildThe text was updated successfully, but these errors were encountered: