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

Object.assign et al are not polyfilled #398

Closed
conatus opened this issue Aug 8, 2016 · 7 comments
Closed

Object.assign et al are not polyfilled #398

conatus opened this issue Aug 8, 2016 · 7 comments
Milestone

Comments

@conatus
Copy link

conatus commented Aug 8, 2016

Hi all,

Thanks for your wonderful work on this.

When testing a React app using create-react-app on a old version of mobile Safari I noticed that Object.assign was failing.

I looked and saw that polyfill support is turned off on the configuration of babel-plugin-transform-runtime https://github.com/facebookincubator/create-react-app/blob/master/config/babel.prod.js#L33-L37

I worked around this by, for the moment, slightly inefficiently manually adding babel-polyfill and using the more "traditional" import 'babel-polyfill'; at the root of the application to include core-js polyfills.

Seems that if the goal is zero configuration setup this is going to be a gotcha for more than a few folks. Unsure if the best approach is to simply turn on the polyfill in babel-plugin-transform-runtime as the documentation seems to suggest this is not the intent of this transformation to supplement native methods like Object.assign.

@conatus
Copy link
Author

conatus commented Aug 8, 2016

@gaearon @vjeux further to Twitter convo.

@gaearon
Copy link
Contributor

gaearon commented Aug 8, 2016

I probably wouldn’t turn on the whole runtime (it’s pretty aggressive and brings in half of core-js).

However Object.assign() seems reasonably since we provide spread operator anyway, and we also use object-assign inside of React itself.

So we’ll probably just do that.

@gaearon gaearon added this to the 0.3.0 milestone Aug 8, 2016
@gaearon gaearon modified the milestones: 0.2.2, 0.3.0 Aug 22, 2016
@mnemanja
Copy link

Hi @gaearon,
I'm at the script version 1.0.12 and IE11 reports this as a problem.
Am I missing some implementation detail? Do I need to import it manually or something like that?

image

Cheers,
Nemanja

@dcp12345678
Copy link

I get exactly the same problem as mnemanja.

Version Info:
C:\src\sandbox\react\my-app>create-react-app --version
1.4.0

@dcp12345678
Copy link

Note: adding this to index.html seems to resolve the create-react-app bug with ie11, but this doesn't feel like a good solution:
<script src="//cdn.polyfill.io/v2/polyfill.min.js"></script>

@Timer
Copy link
Contributor

Timer commented Aug 30, 2017

Can you please open a new issue? It's hard to track in old, closed issues.

@dcp12345678
Copy link

Timer, here you go: #3034

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants