web: [dev-server-storybook] v1 published files are wrong format

Since v1 of web dev server storybook, it no longer works due to wrong file formats.

> wds --config .storybook/server.config.mjs

file:///path/to/node_modules/@web/dev-server-storybook/index.mjs:2
import cjsEntrypoint from './dist/index.js';
       ^^^^^^^^^^^^^
SyntaxError: The requested module './dist/index.js' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

Main MJS entrypoint points to index.mjs:

// this file is autogenerated with the generate-mjs-dts-entrypoints script
import cjsEntrypoint from './dist/index.js';

const { storybookPlugin } = cjsEntrypoint;

export { storybookPlugin };

This is attempting to import a default import from a CJS file, which makes no sense:

  • Why would MJS import from a CJS file
  • There is no default export in that file, only named

I think something might have gone wrong in your build process in the v1 publish

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 26 (26 by maintainers)

Most upvoted comments

Looks good on my end. We’ve merged this version to main, so I’m ready to close this. Please open a new issue with additional reproduction steps if you find this or similar situations arise in your consumption.

Looks like we’re finally OK here. Working through some final things in CI, but the telltale issues we’d been going back and forth between seem to be cleaned up now!

More fun issues… dist is not being published: https://unpkg.com/browse/@web/dev-server-storybook@1.0.3/ 😢

We could down grade without a break, if it’s possible. None of the breaking version’s releases have worked yet. 😖

Ahh, then I might just save us the headache and downgrade.