how do I use ember and requirejs together
-
20-12-2019 - |
Question
I am using require.js for lazy loading files. I added my code in Ember.Route setup method. It's works fine for me unto Ember v1.4. But for Ember 1.5, it's not.
Here is my code:
App.BaseRoute = Ember.Route.extend({
setup : function(context) {
require(_rp, function() {
//.....
this._super(context);
}, function(error){
//.....
});
}
});
Solution
Probably you are suffering from this problem.
There is a blog entry here, describing the problem in the EVER-PRESENT _SUPER (BREAKING BUGFIX) section:
Prior versions of Ember.js used a super mechanism that was un-safe for mixins. If more than one _super was called for a given function name and there was no terminating function, an infinite loop would occur. See #3523 for further discussion.
The solution released in 1.5 fixes this behavior (see #3683), but also breaks the edge-case of using _super out of line. For instance:
doIt: function(){ Ember.run.once(this, this._super); }
Is no longer a supported use of _super. See this jsbin for a live example. If this change impacts you, please comment on #4632.
OTHER TIPS
Following features were added in 1.5
- [FEATURE ember-routing-auto-location]
- [FEATURE ember-routing-bound-action-name]
- [FEATURE ember-routing-inherits-parent-model]
https://github.com/emberjs/ember.js/blob/master/CHANGELOG.md
Maybe something you do on setup now interferes with them? Cannot tell without more code / error description.