-
Notifications
You must be signed in to change notification settings - Fork 27
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
Should include babel runtime with corejs as a regular dependency? #9
Comments
maybe also consider react as peer dependency |
user should provide their own polyfill import '@babel/polifyll' |
If that is the case then this library should not add core-js polyfills via babel |
Yeah, it seems common that a library should not add polyfills, and let library users (developers) add them.
There it is already. Closing this. Please feel free to reopen/open new one for further/another discussion. |
I'm a bit confused about the outcome here. The decision was to not include polyfills in the build output but if you look at the |
Thanks for the input.
I'm not familiar with this. Is this a webpack config or something? I would assume that one can add
So, if you import
You might be able to configure your bundler to use "module" before "main"?
Yeah, I think it's important so that most people can use this library without hassle. |
Thanks for the fast response!
We use pnpm for our dependency management instead of yarn or npm. One of the rules that pnpm adds is that each package can only see the packages that it marks as dependencies. Because core-js isn't a dependency of react-hooks-async, you get compile time errors about missing dependencies. This problem also happens for peer dependencies but you can get around it by doing as you suggested and adding the peer dependency as a dependency to your package. However, for dependencies that aren't marked as a peer dependency and are missing, this won't work and causes the build error.
This does work but just looks fishy when I see that as the import path. If nothing else works I'll create an import alias to get around that, I would just prefer that that wasn't the optimal solution fro this case.
I'll see what I can do to make this happen as that sounds like it would make things easier. |
I see. They have strict rules about dependencies.
If you can use the code in
I'm not sure which bundler you are using, but webpack doesn't seem to allow specifying One option is to use This is going to be a problem for people who use old versions of npm... I wonder how other "async" libraries solve this problem. 🤔 |
I was able to get things working using
Great question, I'll see if I can dig up alternative solutions that could get around this problem. Thanks for your assistance :) |
If you install this library, it may give errors such as this
I believe this is due to not including @babel/runtime-corejs2 as a regular dependency (or maybe @babel/runtime and core-js: 3 as dependencies? not exactly sure)
The text was updated successfully, but these errors were encountered: