Skip to content

Commit

Permalink
Add dotenv-webpack to work around storybookjs/storybook#14403 (#821)
Browse files Browse the repository at this point in the history
storybookjs/storybook#14497 and storybookjs/storybook#14403

tl;dr: Happo stopped working after #818 was merged, it turns out it is because
`npm run build-storybook` crashed due to the above issue(s).

Theoretically this is a workaround and can be removed after storybookjs/storybook#14403 is resolved, but there is no sign of when that'll happen

Deep technical reasons from the linked issue for why this fails:

> If npm hoists dotenv-webpack 6.0.4 to the node_modules root, everything works fine. However, if npm hoists dotenv-webpack 1.8, and the user has a .env file present, start-storybook fails to run.
>
> Unless the user is already pinning dotenv-webpack, the version that gets hoisted depends on how many dependencies are using 1.8 vs 6.0.4. (For example, in the repro steps below, if you remove @storybook/addon-essentials, npm hoists 6.0.4 and things work normally.) This makes for some extremely surprising and hard-to-pin-down behavior.
  • Loading branch information
leonm1 authored Jun 9, 2021
1 parent 8251cb7 commit 704e098
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 16 deletions.
72 changes: 56 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"concurrently": "^5.3.0",
"copy-webpack-plugin": "^6.4.1",
"css-loader": "^5.0.1",
"dotenv-webpack": "^7.0.3",
"error-overlay-webpack-plugin": "^0.4.2",
"eslint": "^7.16.0",
"eslint-config-airbnb": "^18.2.1",
Expand Down

0 comments on commit 704e098

Please sign in to comment.