question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Object.assign et al are not polyfilled

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dcp12345678commented, Aug 30, 2017

I get exactly the same problem as mnemanja.

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

1reaction
mnemanjacommented, Aug 30, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does Object.assign() require a polyfill when babel-loader ...
I'm already using babel-loader to transpile ES6 to ES5, so all my other ES6 code is working. Yet, Object.assign() only works after I...
Read more >
Object.assign() - JavaScript - MDN Web Docs
assign () method copies all enumerable own properties from one or more source objects to a target object. It returns the modified target...
Read more >
Can someone please explain how this Object.assign() polyfill works ...
This is an ES3 Object.assign() polyfill. I can't follow it at all. What is passed into "has"? What does "return assign" return? How...
Read more >
Object.assign and inherited properties - ESDiscuss.org
Hello,. Why does Object.assign ignore inherited enumerable properties? What is the problem to which ignoring inherited properties is the solution to? All I ......
Read more >
Developing Real-Time Web Applications with Server-Sent ...
And that's all. The polyfill will define an EventSource constructor only if it is not natively supported and our code will continue to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found