Closed singles closed 8 years ago
@singles This was done on purpose in the latest version to keep package size smaller. We recommend that you polyfill this yourself using Babel, es6-shim, or a polyfill service like polyfill.io in browsers that don't support this yet.
If you don't want to bring in all of es6-shim, you can also:
npm install object.assign
And then in your source:
if(!Object.assign) {Object.assign = require('object.assign').getPolyfill();}
Making dependencies require special app configuration with some polyfills is really bad. It's like forcing all the consumers to use specific environment and build tools.
And it 100% will cause a LOT of problems for big amount of developers, especially if you update dep, test in chrome and then get errors in browsers like IE totally unexpected.
And reason for making it lighter is really not valid, object-assing
dep weights nothing https://github.com/sindresorhus/object-assign/blob/master/index.js.
@operatino I don't agree: why should fluxible-router apply its own polyfill when I already apply mine? Also: https://twitter.com/iamdustan/status/675354183394983936 :smile:
@gpbl object-assign
is not a polyfill, it's a small library. It doesn't extend the Object, it provides a function that does merging. You don't call Lodash a polyfill right?
Why should developers apply pollyfils requested by dependencies? The more limitation like this we have, the more problems we need to deal with using third party dependencies.
Polyfills are already required to use React, so adding a couple more shouldn't be a big deal. You're right object-assign
isn't that large, but it's still duplicating functionality that is now part of browsers. Many functions in lodash are no longer needed in modern browsers as well, so we would not use it as a whole.
Which kind of polyfills are required by React? ES6 and JSX are optional.
If each dependency will add a couple of polyfills, we'll end up with maintenance nightmare. Just image bumping version of dependencies, that require to re-build whole pipeline.
Internet Explorer doesn't support native Object.assign, so use polyfill instead.