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

core-js 2 as dependency #1629

Closed
Bielik20 opened this issue Nov 24, 2019 · 12 comments
Closed

core-js 2 as dependency #1629

Bielik20 opened this issue Nov 24, 2019 · 12 comments

Comments

@Bielik20
Copy link

Expected behavior

Polyfills should not be included in library, there should be an instruction what is expected to be included in actual app to support given browser.

Actual behavior

App expects core-js 2 as a dependency. That breaks apps based on core-js 3.

Steps to reproduce

If your react app polyfills look somewhat like that:

import 'core-js/stable';

import 'regenerator-runtime/runtime';

Then compilation will fail.

Suggested solution?

Remove polyfills from bundle.

What version of React are you using?

16.10.2

What version of react-beautiful-dnd are you running?

11.0.3

@carlosagsmendes
Copy link

I'm experiencing the same issue using webpack with core-js 3

@carlosagsmendes
Copy link

@Bielik20 would you mind sharing your babel settings? I'm trying to reproduce on a webpack 4 installation from scratch

@Bielik20
Copy link
Author

@carlosagsmendes I am using nrwl to manage my monorepo. It is default config from there.

@alexreardon
Copy link
Collaborator

I'm not sure what the best approach for us should be. Any thoughts @TrySound @theKashey

@theKashey
Copy link

There are two moment - safety and the ease of use. core-js 2/3 is a really big problem and the number affected users would grow, so you have to remove it.
However, it should be a breaking change, or existing installations would break.

In short:

  • don't include polyfills. As well as ponyfills*
  • test and document which ones are required for you. You can use usage-plugin in debug more to get a list of polyfills which are potentially required by this library. Keep in mind - that list would be different for core-js2 and core-js3
  • after knowing which polyfills are really required you might use ponyfills for some of them (like using lodash instead of Array.methods)
  • no further talks before the list of polyfills is known (I'll provide it in a hour)

@alexreardon
Copy link
Collaborator

alexreardon commented Nov 27, 2019

Ideally, we are not pollyfilling anything. My understanding is that we are only using ponyfills

@theKashey
Copy link

From the code - no, you are not. At least it's not documented - https://github.com/atlassian/react-beautiful-dnd/search?q=runtime-corejs2&unscoped_q=runtime-corejs2 and the only expected polyfills are Number.isInteger and Object.values, which could be ponyfilled... but you can't import thst ponyfill from some specific core-js version(though runtime-corejs2).

@theKashey
Copy link

theKashey commented Nov 27, 2019

core-js 3 polyfills required for RBDND for the IE11 target:

File Required
invariant.js es.object.to-string,es.regexp.to-string
dev-warning.js es.string.trim, es.string.replace
native-with-fallback.js es.object.values,es.array.find-index,es.array.find,es.array.slice,es.object.to-string,es.array.iterator,web.dom-collections.iterator
index.js es.weak-map,es.object.to-string,es.string.iterator,es.array.iterator,web.dom-collections.iterator,es.object.get-own-property-descriptor

For esmodules target required:

File Required
dev-warning.js es.string.trim,es.string.replace
native-with-fallback.js es.array.iterator,web.dom-collections.iterator

@TrySound
Copy link
Contributor

Users should provide own polyfills. Though the library may omit usage of a set of functions and implement their loose versions for specific need. I would prefer to drop core-js. rbd is the only lib in my app with core-js in dependencies. And one of a few last commonjs modules.

@theKashey
Copy link

Yep. "omit usage of a set of functions" is one of the reasons why I tend not to use Object.values

@alexreardon
Copy link
Collaborator

@TrySound happy for a PR to make this happen! It was my understanding that we did not polyfill anything (only ponyfills). If we are polyfilling that is bad news.

TrySound added a commit to TrySound/react-beautiful-dnd that referenced this issue Jan 28, 2020
Ref atlassian#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
@danieldelcore
Copy link
Collaborator

Looks like this has already been resolved by @TrySound (Thanks)!

Will close for now but please feel free to reopen if this is still an issue for you!

toptaldev92 pushed a commit to toptaldev92/react-beautiful-dnd that referenced this issue Jul 28, 2021
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
krismark930 added a commit to krismark930/react-beautiful-dnd that referenced this issue May 28, 2022
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
lijin0212 pushed a commit to lijin0212/FDD-react-project that referenced this issue Jun 5, 2022
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
Hashimoto1107 added a commit to Hashimoto1107/react-beauty-dnd that referenced this issue Feb 28, 2023
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
whitedaisy7 added a commit to whitedaisy7/react_beauty that referenced this issue Mar 9, 2023
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
VV-YY added a commit to VV-YY/react-beautiful-dnd that referenced this issue Mar 25, 2023
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
Kami-don pushed a commit to Kami-don/project-321 that referenced this issue Mar 2, 2024
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
bluesky030511 added a commit to bluesky030511/beautiful-dnd that referenced this issue May 6, 2024
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
redsky030428 added a commit to redsky030428/nextjs_bnb that referenced this issue May 13, 2024
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
Watcher919 pushed a commit to Watcher919/react-own-beautiful-dnd that referenced this issue Aug 25, 2024
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
gerald525 added a commit to gerald525/react-own-beauty that referenced this issue Sep 8, 2024
Ref atlassian/react-beautiful-dnd#1629 (comment)

I forbid using es6+ methods I added eslint-plugin-es6. It does not
forbid isInteger but I send PR nkt/eslint-plugin-es5#37.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants