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
upgrade to use lodash 4.17.2 #22
Conversation
@@ -5,6 +5,9 @@ var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); | |||
module.exports = function(defaults) { | |||
var app = new EmberAddon(defaults, { | |||
// Add options here | |||
babel: { | |||
includePolyfill: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not be needed, but right now without it there is a crash in environments without native WeakMap support (like PhantomJS) :( I am trying to figure out what's happening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that if WeakMap is undefined, lodash-es
is trying to export default undefined value, and it seems that during transpilation we getting an object with default property that contains some junk instead of undefined...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for pointing out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I wasn't aware of this (no one brought it up). I'll look into this.
Update:
I believe this is resolved in Babel 6. It should even work with babel-plugin-add-module-exports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdalton unfortunately ember-cli
is stuck on babel 5 /cc @stefanpenner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why am i being cc'd ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stefanpenner Sorry should have been more explicit. I rapidly mentioned to you this issue at EmberConf. The problem here is that null
/undefined
exports are imported as complex objects (instead of null
/undefined
). You said that maybe you had an idea of what the problem/fix might be.
FYI I just tried out this branch, and it worked without issue. Using |
@kellyselden is |
@tchak Nope. No babel options. |
@kellyselden Two reasons it works for you I think. First, you using individual import. So some parts of lodash are not executed. Second, if you trying on half recent chrome or firefox, they probably support WeakMap, Map and Set. When I test with recent browsers, test only fails in PhantomJS. But I definitely do not want for the addon to surprisingly crash on older browsers... |
Any update on this? |
Updates???? |
@tchak Any update? |
Why does lodash require |
Lodash uses |
I must say, I ended up using |
Because lodash-4 makes use of WeakMap, where available, and because in the ember ecosystem that will come by way of babel (v6 to be specific), this is blocked by a core ember-cli issue (and really an ember-cli-babel issue)
This isn't a trivial change to make, since we make broad use of babel in the ember ecosystem. If people want to help out, here are some upstream issues that are blocking progress on ember-cli (see here for the source of truth on status)
|
@jdalton both sides have bugs. v5 and v6 :( Its tricky to balance those trade-offs. |
but remember as long as your addon produces ES5 safe deanonymized AMD we don't care how you go there, if babel 6 works in your addon, it is fine to use. |
Is there anything we can do to get this rolling again? I guess I don't understand the issue here with babel 6, but is there any other alternative to make this upgrade? |
999cb0c
to
4415131
Compare
It works! I found a way! Exports of @mike-north should we do as planed a 3.0 and a 4.0 releases? |
4415131
to
bffcab4
Compare
bffcab4
to
629330b
Compare
629330b
to
4807882
Compare
From @mike-north:
Because lodash-4 makes use of WeakMap, where available, and because in the ember ecosystem that will come by way of babel (v6 to be specific), this is blocked by a core ember-cli issue (and really an ember-cli-babel issue)
This isn't a trivial change to make, since we make broad use of babel in the ember ecosystem. If people want to help out, here are some upstream issues that are blocking progress on ember-cli (see here for the source of truth on status)