On Wed, Feb 18, 2015 at 10:51:29AM -0800, Christian G. Warden wrote: > When using the --browserify option to `cordova prepare`, I'm running into a > problem with a plugin that refers requires other javascript modules defined in > a plugin, either within the same plugin or another one. > > Here's an example: > $ cordova create CordovaBrowserifyTest > $ cd CordovaBrowserifyTest > $ cordova platform add android > $ cordova plugin add > https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin > $ cordova prepare --browserify > Error: Cannot find module 'com.salesforce.util.exec' from > '/home/cwarden/git/CordovaBrowserifyTest/plugins/com.salesforce/www' > at > /home/cwarden/.nvm/v0.11.16/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:51:17 > at process > (/home/cwarden/.nvm/v0.11.16/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:159:43) > at > /home/cwarden/.nvm/v0.11.16/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:168:21 > at load > (/home/cwarden/.nvm/v0.11.16/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:99:43) > at > /home/cwarden/.nvm/v0.11.16/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:105:22 > at > /home/cwarden/.nvm/v0.11.16/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47 > at FSReqWrap.oncomplete (fs.js:99:15) > > > I suspect the problem could be related to the fact that the name of the module > being required, com.salesforce.util.exec, doesn't match the id of the plugin, > com.salesforce.
It looks like I was mistaken. The problem seems to simply be that the browserify transform only handles apache modules and local references correctly. I've been able to get the bundled cordova.js built with a small change: https://github.com/cwarden/cordova-js/commit/943348db348e62e8245c5ca2b7dad6feecc7fb34 Still need to do more testing. Christian --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
