hipstersmoothie / storybook-dark-mode

A storybook addon that lets your users toggle between dark and light mode.
MIT License
429 stars 56 forks source link

Fix: Storybook 6.5.x Yarn PnP preset loading issue #191

Closed jackw closed 1 year ago

jackw commented 1 year ago

I'm sorry for the noise @hipstersmoothie but I'm back again as my previous attempt #187 didn't fix the failed preset loading in Storybook 6.5.x with yarn PnP.

I now believe the problem is two parts... one is the reference to storybook-dark-mode/register in preset.js and the other is a lack of an ESM build. To solve it I referred to the storybook-addon-kit github template and updated the following things to match the latest version of the template:

To test these changes I published this branch to a local verdaccio NPM registry and updated the repository where I can repro the issue to use the local published version. I've since introduced these changes to a yarn patch in our repo and everything is working as expected. 🥳

I'm not sure if replacing register.js with preset.js is a breaking change or not for older versions of storybook. 🤔

📦 Published PR as canary version: 3.0.0-canary.191.4282.0
:sparkles: Test out this PR locally via: ```sh npm install storybook-dark-mode@3.0.0-canary.191.4282.0 # or yarn add storybook-dark-mode@3.0.0-canary.191.4282.0 ```
bryanjtc commented 1 year ago

Any update on this? With storybook v7 around the corner, this pr should help adding support for future breaking changes on v7.

hipstersmoothie commented 1 year ago

I'll merge this! gonna label breaking

hipstersmoothie commented 1 year ago

:rocket: PR was released in v2.0.0 :rocket: