-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
storybook@6 throws a core-js error #11255
Comments
cc @ndelangen |
I have the same problem. |
whut? I'm really confused.. the preview is bundling code for the manager.. and it's missing a devDependency..This makes very little sense.. |
And as @43081j suggests, adding |
I just ran into the same issue trying to update my storybook from 5.2.5 to 6.0.0-rc.9. Like @BWrites I added the latest |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
just a reminder that now that you published 6.0 officially, this is still a problem. it is very awkward having to install |
@43081j I don't think we understand the problem. Perhaps @ndelangen can share some of his wisdom here. |
essentially, storybook's generated output tries to require im guessing because it is generated output and doesn't "live" in the storybook directory ( so if you have storybook in a project which already has a different version of core-js (not necessarily as a direct dependency, all sorts of other projects also depend on core-js), that one may be required by accident rather than the one storybook wants. this means the paths fail to resolve if the two core-js versions are drastically different. the workaround ( |
@43081j would you be available to pair with @ndelangen on this? |
Also having this problem. Based on #6204 (comment), I added this to my config and it's resolving correctly now:
Note that this is pointing to the root |
@shilman ill see if i get some free time at the weekend and will try debug it a bit at least. it'll be to do with the webpack config i guess and where it resolves modules from my guess is we effectively run webpack from the project directory. then when we generate our webpack entry, somewhere down the tree we must require core-js. but by that point, webpack's CWD is the project dir rather than storybook's dir, so it will pick up whatever the root core-js version is instead of the one storybook wants. we could do whats in the previous comment but use the path to storybook's core-js explicitly. but it seems a real shame and a bit hacky since this exact problem could happen with any number of dependencies in theory. |
Same here. Just set up a clean project with vue-cli, added storybook and storybook-docs. |
same here. Updating storybook from 5.3. to 6.0.12 - lead to bunch of errors like |
Same here, even with the workaround :( |
same got a bunch of error like |
@MattFisher which config file? |
@awkale |
Still doesn't work. Just updated with the patch 6.2.0-alpha.1 |
This release has finally fixed it for our component library's Storybook - thanks! |
For those of you whose projects are NOT fixed by
If that still doesn't fix it, perhaps you can post a link to your repo and we might be able to take a look and see what's going on. Thanks and thanks for your patience on this! |
Hey, thanks for the continued work on this. Unfortunately, upgrading to The repository is a mix of JS/typescript, managed by yarn 2 (berry), and has core-js version Module not found: Error: Your application tried to access core-js, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Required package: core-js (via "core-js/modules/es.string.iterator")
// path to some internal code |
I had this problem as well, to fix it I had to delete my node_modules and package-lock.json and update storybook and its add ons to alpha.6, including This got storybook itself to load without errors, unfortunately my Svelte component is no longer recognized - Storybook says it can't find any components despite nothing changing since 5.3. I had to revert to 5.3 since debugging this has already eaten the better part of a day. 5.3 works fine, no issues. my main.js is
my Bot.stories.js file is
|
Hi @shilman, I'm seeing this error using v6.2.0-alpha.10. My use case is that we have a library in node_modules that we are bundeling in our app, so I added this to the custom webpack config: Custom webpack config
Runtime error:
Webpack debug output:
I tried these suggested solutions:
Any suggestions? |
@43081j any chance you can provide some support on this one? looks like people are still running into this issue even after your change. |
the previous problem with somehow the webpack overrides conflicting maybe, its difficult to reproduce that one for sure. @uriklar if you could throw together a test repo which reproduces that problem, that'd be a big help. a minimal reproduction, trying to strip away as much as you can without making the problem go away. same for you @henriquez , if you can reproduce it in a repo somewhere we can try debug a bit |
Good news update on #11255 (comment) I investigated this bug with @arcanis, who quickly identified the issue. We found the error was due to the fact that a dependency of the main application (the one using storybook) was in a separate yarn workspace that did not have Adding the same version of |
Also, I found another workaround: when using yarn pnp + workspaces, if config.resolve.alias["core-js"] = path.dirname(require.resolve("core-js")); ( |
Simply install |
That workaround didn't work for me, I needed to configure specific aliases in the main.js file for core-js modules with name conflicts:
|
@jmlaya you should try the snippet I wrote: config.resolve.alias["core-js"] = path.dirname(require.resolve("core-js")); I did it this way so that it'll work for all submodules si it should help you too |
Adding |
@Ayc0 I did something similar, but these files with these names do not exist anymore in the core-js package:
|
storybookjs/storybook#11255 - updated component logic to use styles and updated stories - 'start-storybook' and 'build-storybook' now working
|
This worked for me when storybook 6 complained about core-js missing in dependency I was loading from another project, the key here is to install core-js in that other project not in the project that is using storybook. (core js was already installed in the project using storybook, but not in the project containing the dependency when the error occurred) |
I have the same problem with you. You can try to add the option corejs: 3 with @babel/preset-env config in your .babelrc file and this works for me.
|
With storybook 6, my very basic typescript setup throws errors about core-js polyfills every time.
this is thrown from 'generated-stories-entry'. i can see earlier in the webpack output that the polyfill was built:
which afaik is where you include core-js.
with storybook 5, this works just fine. its a clean setup from today,
npm i -D @storybook/html
(5 or 6) and this config:I think this is because there are multiple core-js versions in my node_modules and storybook is resolving the wrong one (somehow). if i look at the one inside storybook's packages, its got the right files.
this isn't something i should have to 'fix' though IMO, as so many dependencies use core-js it seems like a very likely situation for many to bump into. my guess is you can fix it by installing core-js as a direct dependency but thats also far from ideal.
EDIT:
Temporary workaround
If you've come across this issue while searching, we do not yet have a solution merged in (this issue will close when we do). However, there is a workaround: simply install core-js@3 as a direct dependency (
npm i -D core-js@3
).If that doesn't work for you, please do comment so we are aware in case there are some other edge cases.
The text was updated successfully, but these errors were encountered: