Commit 738d2272 authored by JC Brand's avatar JC Brand

Solve the intermittent issue of _ not being defined in templates

parent ed9ba788
......@@ -36,7 +36,6 @@ require.config({
"strophe.rsm": "node_modules/strophejs-plugin-rsm/strophe.rsm",
"strophe.vcard": "node_modules/strophejs-plugin-vcard/strophe.vcard",
"text": "node_modules/text/text",
"tpl": "node_modules/lodash-template-loader/loader",
"typeahead": "components/typeahead.js/index",
"lodash": "node_modules/lodash/lodash",
"lodash.noconflict": "src/lodash.noconflict",
......@@ -163,11 +162,15 @@ require.config({
},
packages: [{
name: 'moment',
'name': 'moment',
// This location is relative to baseUrl. Choose bower_components
// or node_modules, depending on how moment was installed.
location: 'node_modules/moment',
main: 'moment'
'location': 'node_modules/moment',
'main': 'moment'
}, {
'name': 'tpl',
'location': 'node_modules/lodash-template-loader',
'main': 'loader'
}],
map: {
......@@ -198,6 +201,6 @@ require.config({
// define module dependencies for modules not using define
shim: {
'awesomplete': { exports: 'Awesomplete' },
'awesomplete': { exports: 'Awesomplete' }
}
});
/*global define */
define(['lodash'], function (_) {
if (!_.isUndefined(require)) {
/* XXX: This is a hack to make sure that the compiled templates have
* access to the _ object.
*
* Otherwise we sometimes get errors like this:
*
* TypeError: Cannot read property 'escape' of undefined
* at eval (./src/templates/chatroom_sidebar.html:6)
*/
var lodashLoader = require.s.contexts._.config.lodashLoader;
lodashLoader.templateSettings.imports = { '_': _ };
require.config({'lodashLoader': lodashLoader});
}
return _.noConflict();
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment