Skip to content
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

Importing core-js/modules/es.promise causes Promise.finally to be undefined #749

Closed
plaa opened this issue Jan 13, 2020 · 2 comments
Closed
Labels

Comments

@plaa
Copy link

plaa commented Jan 13, 2020

I am using Storybook with React Native. I discovered that after Storybook was imported Promise.prototype.finally became undefined. I hunted the problem down to Storybook performing:

import 'core-js/modules/es.promise';

Before the import Promise.prototype.finally is a function, after the import it is undefined (but other promise functions work as expected). Example repo.

I tried also import 'core-js/features/promise' - this changes Promise.prototype.finally from a JS function to native code function and seems to work.

I am unsure whether this is a bug in core-js or in the way Storybook is using core-js.

@zloirock
Copy link
Owner

Yes, with the current logic also should be imported core-js/modules/es.promise.finally. /modules/ path not for direct usage - it should be used by entry points like core-js/es/promise or tools like @babel/preset-env and it should inject required modules.

@plaa
Copy link
Author

plaa commented Jan 14, 2020

In case someone else hits this, I eventually found Storybook #8371. If I understand it correctly, Storybook includes incorrect polyfills in the RN code due to build issues.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants