Closed danielkcz closed 8 years ago
Hmm I see this is gonna be problematic for tests as there is no polyfill.
Which engine is this failing on?
I am clueless on that, Travis is golden compared to this, I don't see any information on what platform it was executing...
Ah I could have scrolled down bit more :) Yea it's failing on 0.10 obviously and it will fail on 0.12 too ... http://node.green/#Object-static-methods
Wow! Hold off with this PR please! I'm running code on production using node 0.10. Please, do not break my production!
I'm somewhat disappointed we are rushing that much. I tend to close such PRs.
Would you elaborate what is going on here?
I am not rushing anything, I should probably put there [WIP] marker. Essentially I just wanted to see if it will work, it was quick change.
I suppose we would need to add manual polyfill there by checking if Object.assign
exists although that still would mean that polyfilled could would have to be included in the package. That's kinda sad story...
Feel free to play with polyfills. Like
Object.assign = Object.assign || require('lodash/assign');
Feel free to play with polyfills. Like
Object.assign = Object.assign || require('lodash/assign');
This only works if the system you build on and the system you run it on are the same. );
Dammit! :)
This only works if the system you build on and the system you run it on are the same. );
When are you bundling on Node 4+ I don't think that require
call can be actually tree-shaken. It will get included in bundle in any case. And if you are just running Node, it will be installed there for you to use. So I think we are good here unless I am missing some scenario.
Ok tests are passing with that polyfill, however instead of lodash I would go with this...
https://github.com/zloirock/core-js/blob/master/library/fn/object/assign.js
That's essentially what Babel is including so with some fingers crossed there wouldn't be multiple implementations in a code for someone bundling with Babel.
@ericelliott Just tried to build stampit with this polyfill included in compose.js
and disabled transform-runtime
. Yet it was included in bundle. So I am convinced that your statement is not true. Even if you bundle on platform that has support, this will be included for any cases it wont be available on executing platform.
However if I enabled transform-runtime
then as much as I am finger crossing there will be double implementation of this. In overall that would mean that using Object.assign
is just bad idea. We should grab some implementation and use that directly. Closing this PR...
Fixes #95