[ https://issues.apache.org/jira/browse/CB-11194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15269008#comment-15269008 ]
ASF GitHub Bot commented on CB-11194: ------------------------------------- Github user jasongin commented on a diff in the pull request: https://github.com/apache/cordova-lib/pull/434#discussion_r61912923 --- Diff: cordova-common/cordova-common.js --- @@ -17,26 +17,40 @@ under the License. */ -exports = module.exports = { - events: require('./src/events'), - superspawn: require('./src/superspawn'), - - ActionStack: require('./src/ActionStack'), - CordovaError: require('./src/CordovaError/CordovaError'), - CordovaLogger: require('./src/CordovaLogger'), - CordovaExternalToolErrorContext: require('./src/CordovaError/CordovaExternalToolErrorContext'), - PlatformJson: require('./src/PlatformJson'), - ConfigParser: require('./src/ConfigParser/ConfigParser.js'), - - PluginInfo: require('./src/PluginInfo/PluginInfo.js'), - PluginInfoProvider: require('./src/PluginInfo/PluginInfoProvider.js'), - - PluginManager: require('./src/PluginManager'), - - ConfigChanges: require('./src/ConfigChanges/ConfigChanges.js'), - ConfigKeeper: require('./src/ConfigChanges/ConfigKeeper.js'), - ConfigFile: require('./src/ConfigChanges/ConfigFile.js'), - mungeUtil: require('./src/ConfigChanges/munge-util.js'), - - xmlHelpers: require('./src/util/xml-helpers') -}; +function addProperty(obj, property, modulePath) { + var val = null; + + // Add properties as getter to delay load the modules on first invocation + Object.defineProperty(obj, property, { + configurable: true, + get: function () { + val = val || require(modulePath); + ob[property] = val; --- End diff -- Also, there should be no need to use the 'val' cache if you are overwriting obj[property]. > Improve cordova load time > ------------------------- > > Key: CB-11194 > URL: https://issues.apache.org/jira/browse/CB-11194 > Project: Apache Cordova > Issue Type: Sub-task > Components: Android, CordovaLib > Reporter: Nikhil Khandelwal > > We can delay load some of our dependencies to improve our load time. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org