From da23015ced817c88760e0b6d7d3047f60babc568 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 2 Feb 2017 22:38:16 +0000 Subject: [PATCH] Massage require.js's config so that builds work without underscore.js --- config.js | 6 +++++- src/underscore-shim.js | 4 ++++ src/wrapper-end.js | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/underscore-shim.js diff --git a/config.js b/config.js index 0a18ebaa3..119552423 100644 --- a/config.js +++ b/config.js @@ -45,6 +45,7 @@ require.config({ "tpl": "node_modules/lodash-template-loader/loader", "typeahead": "components/typeahead.js/index", "lodash": "node_modules/lodash/lodash", + "underscore": "src/underscore-shim", "utils": "src/utils", // Converse @@ -190,6 +191,8 @@ require.config({ // for their 'jquery' dependency. '*': { 'jquery': 'jquery-private', + }, + 'backbone': { "underscore": "lodash" }, // 'jquery-private' wants the real jQuery module @@ -222,6 +225,7 @@ require.config({ 'bigint': { deps: ['crypto'] }, 'strophe.ping': { deps: ['strophe'] }, 'strophe.register': { deps: ['strophe'] }, - 'strophe.vcard': { deps: ['strophe'] } + 'strophe.vcard': { deps: ['strophe'] }, + 'backbone': { deps: ['underscore'] } } }); diff --git a/src/underscore-shim.js b/src/underscore-shim.js new file mode 100644 index 000000000..5616fd5dd --- /dev/null +++ b/src/underscore-shim.js @@ -0,0 +1,4 @@ +/*global define */ +define('underscore', ['lodash'], function (_) { + return _; +}); diff --git a/src/wrapper-end.js b/src/wrapper-end.js index 68eb0c175..71be86738 100644 --- a/src/wrapper-end.js +++ b/src/wrapper-end.js @@ -3,6 +3,7 @@ define('jquery', [], function () { return jQuery; }); define('jquery.browser', [], function () { return jQuery; }); define('typeahead', [], function () { return jQuery; }); define('lodash', [], function () { return _; }); +define('underscore', [], function () { return _; }); define('moment_with_locales', [], function () { return moment; }); define('strophe', [], function () { return {