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

Is core-js a dev dependency? #728

Open
pedroassis opened this issue Oct 27, 2021 · 8 comments
Open

Is core-js a dev dependency? #728

pedroassis opened this issue Oct 27, 2021 · 8 comments

Comments

@pedroassis
Copy link

Can we move core-js to devDependencies?

Its currently conflicting with another lib I have which also uses core-js but another version.

I believe if we move it to dev it will stop the problem.

#324

@pedroassis
Copy link
Author

I tried doing this and it's not simple.

Your build generates a file with the requires core-js directly.

Removing these straight from the built files fixes the problem, my build is already running similar polyfills.

I don't know what to do here, I would guess this conflict shouldn't have happened.

@pedroassis
Copy link
Author

I ended up forking this repo, adding a prepare script required for npm@5

Also removed most of the build configs from babel.config.json

https://github.com/HandleCollections/react-stickynode

I don't think this can be merged here tho.

@redonkulus
Copy link
Contributor

The babel configs was to support commonjs and es module exports. So I don't think we can remove those. Which version of core-js is your dependency using? Is it not on the latest version?

@pedroassis
Copy link
Author

@redonkulus its using v2, indeed removing it prevents the build.

I am guessing I could find a build setting that doesn't add the core-js requires, but still builds the rest.

Any chance you could add a extra build without the core-js requires?

@redonkulus
Copy link
Contributor

Without the core-js requirement, it would require the browser to have the latest features that are required by the library. I can look into releasing a major version bump that removes the core-js dependency, but it would be good if your deps could be updated to use the latest core-js in the meantime. I'm not sure when I will have time to make the changes and test things.

@pedroassis
Copy link
Author

I have multiple libs using v2, some weirdly using v3 without causing the same issues. I'm guessing those aren't really used.

Any chance you could add another build using core-js v2?

I don't know the correct way of doing this, what if I was using core-js v3 and already polyfilling those?

Is your lib adding duplicated code to my app? Should you export one without the polyfills and let my build do it?

@redonkulus
Copy link
Contributor

The goal would be to remove the polyfills and require the apps to provide it. That's what the major version bump would provide.

@pedroassis
Copy link
Author

pedroassis commented Oct 30, 2021

@redonkulus I believe the best way would be not to rely on polyfills at all.

Use babel to transpile straight to es5, that way no compat issues could arise.

I also noticed all of the polyfills were not directly used in your code, weird.

I'll keep using my fork for now, there core-js isn't added, it worked down to ie11 so I think I should be good.

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

No branches or pull requests

2 participants