You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Christian G. Warden" <cw...@xerus.org> on 2015/02/18 19:51:29 UTC

prepare --browserify fails to find referenced modules

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.

Any suggestions?

Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: prepare --browserify fails to find referenced modules

Posted by Steven Gill <st...@gmail.com>.
Cordova-lib has some tests:

https://github.com/apache/cordova-lib/blob/master/cordova-lib/spec-plugman/uninstall-browserify.spec.js
https://github.com/apache/cordova-lib/blob/master/cordova-lib/spec-plugman/install-browserify.spec.js

We probably want to add more tests too.

I was mainly speaking about testing/running our core plugins and making
sure they still work with the new change.

On Fri, Feb 20, 2015 at 5:58 PM, Christian G. Warden <cw...@xerus.org>
wrote:

> Hi Steven,
> I would be happy to submit a pull request.  Can you point me in the
> direction of the tests that should be updated?  I'm not seeing
> anything obvious related to browserify in the test directory.
>
> Christian
>
> On Thu, Feb 19, 2015 at 04:02:19PM -0700, Steven Gill wrote:
> > Good catch. Thanks for letting us know. Do you mind sending over a pull
> > request? I will have to test it with our core plugins.
> >
> > On Wed, Feb 18, 2015 at 9:55 PM, Christian G. Warden <cw...@xerus.org>
> > wrote:
> >
> > > 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: dev-unsubscribe@cordova.apache.org
> > > For additional commands, e-mail: dev-help@cordova.apache.org
> > >
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>
>

Re: prepare --browserify fails to find referenced modules

Posted by "Christian G. Warden" <cw...@xerus.org>.
Hi Steven,
I would be happy to submit a pull request.  Can you point me in the
direction of the tests that should be updated?  I'm not seeing
anything obvious related to browserify in the test directory.

Christian

On Thu, Feb 19, 2015 at 04:02:19PM -0700, Steven Gill wrote:
> Good catch. Thanks for letting us know. Do you mind sending over a pull
> request? I will have to test it with our core plugins.
> 
> On Wed, Feb 18, 2015 at 9:55 PM, Christian G. Warden <cw...@xerus.org>
> wrote:
> 
> > 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: dev-unsubscribe@cordova.apache.org
> > For additional commands, e-mail: dev-help@cordova.apache.org
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Re: prepare --browserify fails to find referenced modules

Posted by Steven Gill <st...@gmail.com>.
Good catch. Thanks for letting us know. Do you mind sending over a pull
request? I will have to test it with our core plugins.

On Wed, Feb 18, 2015 at 9:55 PM, Christian G. Warden <cw...@xerus.org>
wrote:

> 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: dev-unsubscribe@cordova.apache.org
> For additional commands, e-mail: dev-help@cordova.apache.org
>
>

Re: prepare --browserify fails to find referenced modules

Posted by "Christian G. Warden" <cw...@xerus.org>.
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: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org