app-module-path-node icon indicating copy to clipboard operation
app-module-path-node copied to clipboard

unable to resolve my modules

Open rajashekhargundeti opened this issue 8 years ago • 0 comments

Hi,

I'm trying to use this module in my application. it is working fine. Now, i'm trying to make a feature of my application as a module and try to use your module with in that module, this time it is giving problem and not resolving my module submodules.

Here is the folder structure:

App-
      - server.js
      - node_modules
                 -myModule
                             - index.js
                             - lib
                                  - conf
                                       - ConfigMgr.js
                                  - processors
                                       - DataProcessor.js
                           - node_modules
                                    app-module-path

server.js : 
      require('myModule');

myModule/index.js : 
var amp = require('app-module-path')
amp.addPath(path.join(__dirname, "lib");

var DataProcessor = require("processors/DataProcessor");
module.exports = DataProcessor

myModule/lib/processors/DataProcessor:
     var ConfigMgr = require("conf/ConfigMgr"); -- failing here. 

The same structure worked fine as an application. But when i tried it as a module, it is not resolving the packages.

rajashekhargundeti avatar Apr 12 '17 14:04 rajashekhargundeti