cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevengill <...@git.apache.org>
Subject [GitHub] cordova-js issue #146: CB-13163: fix using relative paths in calls to requir...
Date Fri, 25 Aug 2017 05:17:52 GMT
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


Mime
View raw message