I had RequireJS 2.1.8 running fine with my Meteor 1.2.1 application.
I upgraded to Meteor 1.3, but now I have the following error: “require.config is not a function”. I explained the problem on StackOverflow, but I just also found out that you guys don’t like SO that much, and I can understand why. To save time, here’s my full question:
Specifically, in my Iron Router routes I had:
waitOn: function() {
return IRLibLoader.load(requireUrl, {
success: function() {
require.config({
baseUrl: Meteor.settings.public.rumeurUrl
});
}
});
}
I upgraded to Meteor 1.3, but now I have the following error: “require.config is not a function”.
Looking further, I can see that the modules-runtime package defines its own require variable.
I tried a “require = requirejs” right before the require.config call, which makes my require.config line run fine, but then Meteor hangs with the following error:
Exception from Tracker afterFlush function:
meteor.js?hash=ec96c6f…:913 TypeError: id.charAt is not a function
at fileResolve (modules-runtime.js?hash=939c79d…:288)
at require (modules-runtime.js?hash=939c79d…:90)
at .<anonymous> (index.js:6)
at blaze.js?hash=38069f4…:3331
at Function.Template._withTemplateInstanceFunc (blaze.js?hash=38069f4…:3677)
at fireCallbacks (blaze.js?hash=38069f4…:3327)
at .<anonymous> (blaze.js?hash=38069f4…:3420)
at blaze.js?hash=38069f4…:1773
at Object.Blaze._withCurrentView (blaze.js?hash=38069f4…:2204)
at blaze.js?hash=38069f4…:1772
Seems like Meteor doesn’t want a “require” redefinition on its side.
How can I have Meteor 1.3 and RequireJS coexist happily?
PS: finally found out the answer and added it as a reply below for anyone facing the same problem.