1313 *---------------------------------------------------------------------------------------------
1414 *---------------------------------------------------------------------------------------------
1515 *--------------------------------------------------------------------------------------------*/
16- /// <reference path="declares.ts" />
1716'use strict' ;
1817// Limitation: To load jquery through the loader, always require 'jquery' and add a path for it in the loader configuration
1918var _amdLoaderGlobal = this , define ;
@@ -123,7 +122,7 @@ var AMDLoader;
123122 } ;
124123 Utilities . NEXT_ANONYMOUS_ID = 1 ;
125124 return Utilities ;
126- } ) ( ) ;
125+ } ( ) ) ;
127126 AMDLoader . Utilities = Utilities ;
128127 var ConfigurationOptionsUtil = ( function ( ) {
129128 function ConfigurationOptionsUtil ( ) {
@@ -189,6 +188,9 @@ var AMDLoader;
189188 options . baseUrl += '/' ;
190189 }
191190 }
191+ if ( ! Array . isArray ( options . nodeModules ) ) {
192+ options . nodeModules = [ ] ;
193+ }
192194 return options ;
193195 } ;
194196 ConfigurationOptionsUtil . mergeConfigurationOptions = function ( overwrite , base ) {
@@ -232,7 +234,7 @@ var AMDLoader;
232234 return ConfigurationOptionsUtil . validateConfigurationOptions ( result ) ;
233235 } ;
234236 return ConfigurationOptionsUtil ;
235- } ) ( ) ;
237+ } ( ) ) ;
236238 AMDLoader . ConfigurationOptionsUtil = ConfigurationOptionsUtil ;
237239 var Configuration = ( function ( ) {
238240 function Configuration ( options ) {
@@ -428,6 +430,10 @@ var AMDLoader;
428430 * Transform a module id to a location. Appends .js to module ids
429431 */
430432 Configuration . prototype . moduleIdToPaths = function ( moduleId ) {
433+ if ( this . isBuild ( ) && this . options . nodeModules . indexOf ( moduleId ) >= 0 ) {
434+ // This is a node module and we are at build time, drop it
435+ return [ 'empty:' ] ;
436+ }
431437 var result = moduleId ;
432438 if ( this . overwriteModuleIdToPath . hasOwnProperty ( result ) ) {
433439 result = this . overwriteModuleIdToPath [ result ] ;
@@ -522,7 +528,7 @@ var AMDLoader;
522528 this . options . onError ( err ) ;
523529 } ;
524530 return Configuration ;
525- } ) ( ) ;
531+ } ( ) ) ;
526532 AMDLoader . Configuration = Configuration ;
527533 // ------------------------------------------------------------------------
528534 // ModuleIdResolver
@@ -602,7 +608,7 @@ var AMDLoader;
602608 this . _config . onError ( err ) ;
603609 } ;
604610 return ModuleIdResolver ;
605- } ) ( ) ;
611+ } ( ) ) ;
606612 AMDLoader . ModuleIdResolver = ModuleIdResolver ;
607613 // ------------------------------------------------------------------------
608614 // Module
@@ -832,7 +838,7 @@ var AMDLoader;
832838 return this . _unresolvedDependenciesCount === 0 ;
833839 } ;
834840 return Module ;
835- } ) ( ) ;
841+ } ( ) ) ;
836842 AMDLoader . Module = Module ;
837843 // ------------------------------------------------------------------------
838844 // LoaderEvent
@@ -859,7 +865,7 @@ var AMDLoader;
859865 this . timestamp = timestamp ;
860866 }
861867 return LoaderEvent ;
862- } ) ( ) ;
868+ } ( ) ) ;
863869 AMDLoader . LoaderEvent = LoaderEvent ;
864870 var LoaderEventRecorder = ( function ( ) {
865871 function LoaderEventRecorder ( loaderAvailableTimestamp ) {
@@ -872,7 +878,7 @@ var AMDLoader;
872878 return this . _events ;
873879 } ;
874880 return LoaderEventRecorder ;
875- } ) ( ) ;
881+ } ( ) ) ;
876882 AMDLoader . LoaderEventRecorder = LoaderEventRecorder ;
877883 var NullLoaderEventRecorder = ( function ( ) {
878884 function NullLoaderEventRecorder ( ) {
@@ -885,7 +891,7 @@ var AMDLoader;
885891 } ;
886892 NullLoaderEventRecorder . INSTANCE = new NullLoaderEventRecorder ( ) ;
887893 return NullLoaderEventRecorder ;
888- } ) ( ) ;
894+ } ( ) ) ;
889895 AMDLoader . NullLoaderEventRecorder = NullLoaderEventRecorder ;
890896 var ModuleManager = ( function ( ) {
891897 function ModuleManager ( scriptLoader ) {
@@ -1520,7 +1526,7 @@ var AMDLoader;
15201526 }
15211527 } ;
15221528 return ModuleManager ;
1523- } ) ( ) ;
1529+ } ( ) ) ;
15241530 AMDLoader . ModuleManager = ModuleManager ;
15251531 /**
15261532 * Load `scriptSrc` only once (avoid multiple <script> tags)
@@ -1561,7 +1567,7 @@ var AMDLoader;
15611567 }
15621568 } ;
15631569 return OnlyOnceScriptLoader ;
1564- } ) ( ) ;
1570+ } ( ) ) ;
15651571 var BrowserScriptLoader = ( function ( ) {
15661572 function BrowserScriptLoader ( ) {
15671573 }
@@ -1628,7 +1634,7 @@ var AMDLoader;
16281634 document . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( script ) ;
16291635 } ;
16301636 return BrowserScriptLoader ;
1631- } ) ( ) ;
1637+ } ( ) ) ;
16321638 var WorkerScriptLoader = ( function ( ) {
16331639 function WorkerScriptLoader ( ) {
16341640 this . loadCalls = [ ] ;
@@ -1681,7 +1687,7 @@ var AMDLoader;
16811687 }
16821688 } ;
16831689 return WorkerScriptLoader ;
1684- } ) ( ) ;
1690+ } ( ) ) ;
16851691 var NodeScriptLoader = ( function ( ) {
16861692 function NodeScriptLoader ( ) {
16871693 this . _initialized = false ;
@@ -1760,7 +1766,7 @@ var AMDLoader;
17601766 } ;
17611767 NodeScriptLoader . _BOM = 0xFEFF ;
17621768 return NodeScriptLoader ;
1763- } ) ( ) ;
1769+ } ( ) ) ;
17641770 // ------------------------------------------------------------------------
17651771 // ------------------------------------------------------------------------
17661772 // ------------------------------------------------------------------------
@@ -1790,7 +1796,7 @@ var AMDLoader;
17901796 jQuery : true
17911797 } ;
17921798 return DefineFunc ;
1793- } ) ( ) ;
1799+ } ( ) ) ;
17941800 var RequireFunc = ( function ( ) {
17951801 function RequireFunc ( ) {
17961802 if ( arguments . length === 1 ) {
@@ -1837,7 +1843,7 @@ var AMDLoader;
18371843 return moduleManager . getLoaderEvents ( ) ;
18381844 } ;
18391845 return RequireFunc ;
1840- } ) ( ) ;
1846+ } ( ) ) ;
18411847 var global = _amdLoaderGlobal , hasPerformanceNow = ( global . performance && typeof global . performance . now === 'function' ) , isWebWorker , isElectronRenderer , isElectronMain , isNode , scriptLoader , moduleManager , loaderAvailableTimestamp ;
18421848 function initVars ( ) {
18431849 isWebWorker = ( typeof global . importScripts === 'function' ) ;
0 commit comments