You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by filmaj <gi...@git.apache.org> on 2017/08/10 03:10:22 UTC

[GitHub] cordova-js pull request #146: CB-13163: fix using relative paths in calls to...

GitHub user filmaj opened a pull request:

    https://github.com/apache/cordova-js/pull/146

    CB-13163: fix using relative paths in calls to require.

    Using relative paths in calls to `require` failed.
    
    The single-character patch caused me to chuckle.
    
    Added a test for this as well.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/filmaj/cordova-js fix-rel-req

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-js/pull/146.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #146
    
----
commit 65fd0f61cca4d979e653ab5cf2dbc32b50416ba9
Author: filmaj <ma...@gmail.com>
Date:   2017-08-10T03:08:51Z

    CB-13163: fix using relative paths in calls to require.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-js issue #146: CB-13163: fix using relative paths in calls to requir...

Posted by stevengill <gi...@git.apache.org>.
Github user stevengill commented on the issue:

    https://github.com/apache/cordova-js/pull/146
  
    If you checkout https://github.com/apache/cordova-ios/pull/333, you can see that I fixed the relative require for console. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-js issue #146: CB-13163: fix using relative paths in calls to requir...

Posted by filmaj <gi...@git.apache.org>.
Github user filmaj commented on the issue:

    https://github.com/apache/cordova-js/pull/146
  
    Just to make sure people here see it: reverting this commit, and leaving relative `require` calls in e.g. the integrated console plugin in cordova-ios will lead to errors such as:
    
    <img width="339" alt="screen shot 2017-08-09 at 7 45 46 pm" src="https://user-images.githubusercontent.com/52645/29864183-364a861a-8d72-11e7-9515-486af106c1df.png">



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-js issue #146: CB-13163: fix using relative paths in calls to requir...

Posted by purplecabbage <gi...@git.apache.org>.
Github user purplecabbage commented on the issue:

    https://github.com/apache/cordova-js/pull/146
  
    This broke other stuff :(
    cordova-browser cannot install cordova-plugin-device-motion fails, for example.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-js pull request #146: CB-13163: fix using relative paths in calls to...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-js/pull/146


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-js issue #146: CB-13163: fix using relative paths in calls to requir...

Posted by stevengill <gi...@git.apache.org>.
Github user stevengill commented on the issue:

    https://github.com/apache/cordova-js/pull/146
  
    I had to revert this as it broke all of our plugins that use local require syntax (ex. cordova device-motion at https://github.com/apache/cordova-plugin-device-motion/blob/master/www/accelerometer.js#L29)
    
    cordova's require handles local require very differently than node's local require.
    
    Cordova require would convert `require('./Acceleration')` into `cordova-plugin-device-motion.Acceleration`. Then is uses some sort of mapping to grab and include the code (I haven't dug into it)
    
    This PR wants `require(./logger)` to become `require('cordova/plugin/ios/logger')` instead of `cordova-plugin-console.logger`. (Once again, I haven't dug into why the mapping isn't working now that the plugin is local. I think it is because the console plugin code is baked into cordova.js instead of being included during runtime like plugin js code).
    
    Instead of this PR, I'm going to fix the require call at https://github.com/apache/cordova-ios/blob/master/cordova-js-src/plugin/ios/console.js#L24.
    
    It will change from `require('./logger')` into `require('cordova/plugin/ios/logger')`. Now the local require is working for logger and cordova's local require continues working as it has been for the last few years.
    
    Ultimately, cordova.js & how we load plugins needs to rethought and refactored. 
    
    
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] cordova-js issue #146: CB-13163: fix using relative paths in calls to requir...

Posted by filmaj <gi...@git.apache.org>.
Github user filmaj commented on the issue:

    https://github.com/apache/cordova-js/pull/146
  
    OK, sorry that this change broke stuff! My bad.
    
    Chalk up a "make cordova's `require` work more like node / other `require` implementations" to the todo list?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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