-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Are not all ES6 features polyfilled? #2765
Comments
It says:
(Emphasis added) So it wasn't about runtime ES6 feature, but about syntax. The paragraph below mentions polyfills:
Hope this explains it! You probably missed this part.
You don't need to eject. Just add a polyfill like you normally would, in
import 'core-js/es6/symbol'; Does this help? |
It does indeed! I thought "for of" was syntactic sugar. So perhaps that's where the confusion came from. Thanks a bunch! |
Yea, syntax that depends on runtime features is where it gets tricky. Thanks for highlighting this. We should probably mention such caveats. |
Maybe it's worth including a Symbol polyfill? IIRC it'll be needed for React 16 and I would consider adding it simply because it's used by for-of (which is syntax). |
It’s not required by React 16, no (but Map, and Set are). |
If #2358 merged, maybe we don't have to curate the polyfills anymore? We can statically analyze it and ship what they need. IMO leaving polyfills to the user causes an issue like this. I think adding a polyfill counts as "config" on the user space, so, can we add this magic? 😄 |
@gaearon how to config?(like object-rest-spread, async-generator ... ) i have failed many times |
@meooxx I'm not sure what you're asking? All of these things work out of the box -- you do not need to think about them. |
@Timer .. Note that the project only includes a few ES6 polyfills: |
ES6 polyfills enable new language features, not syntax features. |
@Timer but it throws error " need an appropriate loader to handle this file type " |
@Timer you are right . my mistakes |
I hope that it will help some future people in a situation like mine: after upgrading from
A solution is to simply replace the whole content of config/pollyfills.js with single line
|
Are |
Nope! That is documented in the React documentation, but feel free to send a PR adding it to ours too. |
Documented in 419e4d8. |
This is why With IN import "@babel/polyfill"; OUT (different based on environment) import "core-js/modules/es7.string.pad-start";
import "core-js/modules/es7.string.pad-end"; |
@gaearon shouldn't this |
In the documents on the section of polyfills there is the following line: "In addition to ES6 syntax features, it also supports:"
Which makes me presume all ES6 features are supported (and then some). However, when using for-of it seems to fail in IE11 which has no support for for-of.
Below the failure.
Now for that example it's a trivial fix, but the sentence in the documentation makes me think it should be supported. Can't seem to add support without ejecting, which I prefer not to for this simple thing. But still.
I've updated to react-scripts 1.0.10, but that does not seem to make a difference.
The text was updated successfully, but these errors were encountered: