VandyHacks / vaken

Next-gen hackathon registration system
MIT License
49 stars 12 forks source link

Add dotenv-webpack to work around storybookjs/storybook#14403 #821

Closed leonm1 closed 3 years ago

leonm1 commented 3 years ago

https://github.com/storybookjs/storybook/issues/14497 and https://github.com/storybookjs/storybook/issues/14403

tl;dr: Happo stopped working because npm run build-storybook was failing after #818 upgraded webpack to a new minor version and threw us into the weird implicit hoisting mess described below.

Theoretically this is a workaround and can be removed after https://github.com/storybookjs/storybook/issues/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.

codeclimate[bot] commented 3 years ago

Code Climate has analyzed commit 836b4dc5 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (0% is the threshold).

This pull request will bring the total coverage in the repository to 63.4% (0.0% change).

View more on Code Climate.

leonm1 commented 3 years ago

As you can see, the CI / Happo Screnshot Diffs (pull_request) check now completes successfully