react-stickynode icon indicating copy to clipboard operation
react-stickynode copied to clipboard

Is core-js a dev dependency?

Open pedroassis opened this issue 4 years ago • 8 comments

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.

https://github.com/yahoo/react-stickynode/issues/324

pedroassis avatar Oct 27 '21 14:10 pedroassis

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 avatar Oct 27 '21 15:10 pedroassis

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.

pedroassis avatar Oct 27 '21 15:10 pedroassis

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?

redonkulus avatar Oct 27 '21 17:10 redonkulus

@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?

pedroassis avatar Oct 27 '21 17:10 pedroassis

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.

redonkulus avatar Oct 27 '21 17:10 redonkulus

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?

pedroassis avatar Oct 27 '21 18:10 pedroassis

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

redonkulus avatar Oct 27 '21 20:10 redonkulus

@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.

pedroassis avatar Oct 30 '21 15:10 pedroassis