Describe the bug
storybook packages are not declaring a dependency on core-js in package.json, unable to run using pnpm as a packager without adding core-js or hacking the core-js dependency in.
To Reproduce
set up react-native project using pnpm rather than yarn/npm. when bundling, @storybook/react-native and many other @storybook packages are unable to resolve require imports to core-js/
Expected behavior
bundling is successful with defining extra dependencies in project consuming storybook
System:
Additional context
pnpm enforces correct dependencies by isolating each package's dependencies in subfolders under it rather than merging everything in the same node_modules common folder.
I am having the same issue when using npm
, adding core-js
to my devDependencies solved it but I shouldn't have to do that.
This is also happening with @storybook/[email protected]
. @andrewmarmion's suggestion solves this, but as he said this shouldn't be needed.
@storybook/[email protected]
is getting close. thanks for your patience everybody!
PS this is not a react-native specific issue
The issue here is pnpm
and it's non-deduping module install. I suspect the only fix would be to depend on core-js
from every manager-side package. Is this the right solution?
Another option would be to use a webpack resolve alias
Hmm.. there already is an alias: https://github.com/storybooks/storybook/blob/b19ae6b9e44e8759a4735169059cfa05f104d5e9/lib/ui/paths.js#L15
Without a reproduction I am not totally sure but I am guessing the issue may come from the preview side. I see that app/react
has a dependency on core-js
but app/react-native
does not. @adamcarriere can you post the stack trace of the error you saw?
I'm seeing something similar - I get a ton of errors like:
ModuleNotFoundError: Module not found: Error: Can't resolve 'core-js/modules/es6.string.bold' in '[...]/node_modules/@storybook/ui/node_modules/@storybook/components/dist/tooltip'
In my case, [email protected] and [email protected] was working fine. Upgrading react to 16.8.4 causes the error below.
ModuleNotFoundError: Module not found: Error: Can't resolve 'core-js/modules/es7.symbol.async-iterator' in '[...]/node_modules/@storybook/core/dist/client/manager'
@petewarman @ysgk are you using pnpm?
@ysgk this is pretty surprising as @storybook/core
does in fact depend directly on core-js
. What do you your node_modules
look like? Is core-js
resolvable from @storybook/core
? What version?
I hate to suggest it but you could probably try removing node_modules
and re-running your package manager installation.
I鈥檓 using yarn.
OK I think the original issue title is the correct way forwards, we should add a dependency on core-js
to all our packages
I鈥檓 using yarn too.
Removing node_modules and re-running yarn resulted in the same error.
I forgot to remove yarn.lock. Removing node_modules and yarn.lock and re-running yarn works.
My case seems to be a yarn-related problem.
@ysgk I'm not surprised to hear that, sadly
Whoopee!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-alpha.2 containing PR #5961 that references this issue. Upgrade today to try it out!
Because it's a pre-release you can find it on the @next
NPM tag.
Closing this issue. Please re-open if you think there's still more to do.
馃挜Works for me now - thanks!
@tmeasday is here to save the day
Yo-ho-ho!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.1 containing PR #5961 that references this issue. Upgrade today to try it out!
Most helpful comment
I'm seeing something similar - I get a ton of errors like: