web icon indicating copy to clipboard operation
web copied to clipboard

Storybook Builder: Globals from Storybook Missing

Open enqueue opened this issue 1 year ago • 3 comments

I am currently migrating a project from @web/dev-server-storybook plugin to the new @web/storybook-builder, and ran into an error when starting the storybook:

> storybook dev -p 6006

@storybook/cli v7.6.2

(node:18301) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
info => Serving static files from ././storybook-assets at /storybook-assets
info => Starting manager..
info => Starting preview..
=> Failed to build the preview
TypeError: Missing mandatory option 'globals'
    at createPlugin (./node_modules/rollup-plugin-external-globals/index.js:9:11)
    at wrappedRollupPluginFn (./node_modules/@web/dev-server-rollup/dist/fromRollup.js:12:30)
    at Module.start (./node_modules/@web/storybook-builder/dist/index.js:75:13)

I am not very familiar with the dependency mechanism and module exports, but it seems to me that in a more recent version of Storybook, the global constants are not exported as globals, but only as globalsNameReferenceMap (see commit 81c2807).

You might consider this as a mistake on behalf of Storybook maintainers, but it would probably be fixable by adjusting the import here.

I changed globals to globalsNameReferenceMap temporarily in the index.js to work around this issue.

enqueue avatar Dec 01 '23 10:12 enqueue

Hm, that's super weird. IIUC, Storybook updated a minor version and changed the export name? If so, that's now how SemVer should work. I'll have a look what really happened here and what is the best way to solve it. Thanks for sharing this!

bashmish avatar Dec 04 '23 14:12 bashmish

This should be fixed with #2620 :muscle:

florian-sanders-cc avatar Jan 25 '24 07:01 florian-sanders-cc

Yes, thank you!

enqueue avatar Jan 29 '24 07:01 enqueue