Require issue?
I have some modules (non ui) which I'm using throughout my app.
I have a structure like
/root/
-index.ios.js
-/app/
--MyModule.js
-/core/
--MyModule2.js
When I refer to a module via index.ios.js, it works fine: e.g.
var MyModule = require('./app/MyModule');
...
var MyModule2 = require('./core/MyModule2');
If I try to reference a module elsewhere (i.e. in the /apps/ folder, I have a reference from MyModule to MyModule2 which is in /core/), I have to put a full path with extension:
var MyModule2 = require('MyApp/core/MyModule2.js');
I'm sure, after surfing google for answers yesterday, I had read something about this and require paths but I can't find where I read it! In any case I would like to structure my app, is it possible?
I've found the need to use relative paths. *require('../SomeDir/SomeModule'). Works like a champ
Ok great! I'll try that on Monday. I guess I can close this, thanks!
👍
@jaygarcia, it works! Cheers! :+1:
I can use relative paths. Unfortunately, thousands of import lines in inherited codebase can't. What now?