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:
[x] Remove deprecated register.js in favour of preset.js
[x] Rename register.tsx to manager.tsx and update preset.js to point to the dist/esm/manager
[x] Updated the build scripts to use babel and create esm and cjs builds of the addon
[x] 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
: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
```
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 thestorybook-addon-kit
github template and updated the following things to match the latest version of the template:register.js
in favour ofpreset.js
register.tsx
tomanager.tsx
and update preset.js to point to thedist/esm/manager
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
withpreset.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 ```