Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

jackw
Copy link
Contributor

@jackw jackw commented Sep 28, 2022

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:

  • Remove deprecated register.js in favour of preset.js
  • Rename register.tsx to manager.tsx and update preset.js to point to the dist/esm/manager
  • Updated the build scripts to use babel and create esm and cjs builds of the addon
  • Update tsconfig.json

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

✨ Test out this PR locally via:

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
Copy link

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

@hipstersmoothie
Copy link
Owner

I'll merge this! gonna label breaking

@hipstersmoothie hipstersmoothie added the major Increment the major version when merged label Dec 5, 2022
@hipstersmoothie hipstersmoothie merged commit 8b6bdb3 into hipstersmoothie:master Dec 5, 2022
@hipstersmoothie
Copy link
Owner

🚀 PR was released in v2.0.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Increment the major version when merged released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants