From 977140ef834fa4207fa513999b6120b02d078457 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Mon, 11 May 2015 00:04:43 +0000 Subject: [PATCH] Normalize requirejs/require calls See https://github.com/jrburke/requirejs/issues/428#issuecomment-95371335 --- README.md | 4 ++-- tools/build.js | 2 +- www/js/page1.js | 4 ++-- www/js/page2.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 52241ac..58954d9 100644 --- a/README.md +++ b/README.md @@ -63,12 +63,12 @@ As you do builds and see in the build output that each page is including the same module, add it to common's "include" array in **tools/build.js**. It is better to add these common modules to the **tools/build.js** config -instead of doing a require([]) call for them in **js/common.js**. Modules that +instead of doing a requirejs([]) call for them in **js/common.js**. Modules that are not explicitly required at runtime are not executed when added to common.js via the include build option. So by using **tools/build.js**, you can include common modules that may be in 2-3 pages but not all pages. For pages that do not need a particular common module, it will not be executed. If you put in a -require() call for it in **js/common.js**, then it will always be executed. +requirejs() call for it in **js/common.js**, then it will always be executed. ## More info diff --git a/tools/build.js b/tools/build.js index 36f50db..2fa4792 100644 --- a/tools/build.js +++ b/tools/build.js @@ -27,7 +27,7 @@ //listed before the build layer that wants to exclude it. //"include" the appropriate "app/main*" module since by default //it will not get added to the build since it is loaded by a nested - //require in the page*.js files. + //requirejs in the page*.js files. { //module names are relative to baseUrl/paths config name: '../page1', diff --git a/www/js/page1.js b/www/js/page1.js index 4a7c017..01d0f83 100644 --- a/www/js/page1.js +++ b/www/js/page1.js @@ -1,4 +1,4 @@ //Load common code that includes config, then load the app logic for this page. -require(['./common'], function (common) { - require(['app/main1']); +requirejs(['./common'], function (common) { + requirejs(['app/main1']); }); diff --git a/www/js/page2.js b/www/js/page2.js index 3451877..3cd3e12 100644 --- a/www/js/page2.js +++ b/www/js/page2.js @@ -1,4 +1,4 @@ //Load common code that includes config, then load the app logic for this page. -require(['./common'], function (common) { - require(['app/main2']); +requirejs(['./common'], function (common) { + requirejs(['app/main2']); });