Preset file is also .mjs, but the Storybook expects package.json exports to define it without extension.
Ideally I think the extension should be also part of the public interface, so it's just a file and node should be able to load ".mjs" normally. Right now I think the problem is somewhere in interopRequireDefault, not sure why it's only happening on Windows.
Describe the bug
If you publish an addon with a preset written in ESM, it's not being loaded on Windows. E.g. we published https://www.npmjs.com/package/@web/storybook-framework-web-components as ESM
Tested on Windows 10 and 11. (It works on macOS though, tested on Sonoma 14.4.1, so seems to be a Windows specific bug)
Reproduction link
https://github.com/thepassle/sb-windows-repro
Reproduction steps
git clone https://github.com/thepassle/sb-windows-repro.git cd sb-windows-repo npm i npm start
System
Additional context
Preset file is also
.mjs
, but the Storybook expects package.jsonexports
to define it without extension. Ideally I think the extension should be also part of the public interface, so it's just a file and node should be able to load ".mjs" normally. Right now I think the problem is somewhere ininteropRequireDefault
, not sure why it's only happening on Windows.