So, when trying to resolve module 'fbjs/lib/invariant', from React, I'm getting a no module found exception.
When debugging the module, seems like it could be related with this method.
private Module searchForModuleInNodeModules(Folder from, String filename) throws ScriptException {
Folder current = from;
while (current != null) {
Folder nodeModules = current.getFolder("node_modules");
if (nodeModules != null) {
Module found = attemptToLoadFromThisFolder(nodeModules, filename);
if (found != null) {
return found;
}
}
current = current.getParent();
}
return null;
}
It does not seem to mimic the NodeJS behaviour, at least according to this
NODE_MODULES_PATHS(START)
1. let PARTS = path split(START)
2. let I = count of PARTS - 1
3. let DIRS = []
4. while I >= 0,
a. if PARTS[I] = "node_modules" CONTINUE
c. DIR = path join(PARTS[0 .. I] + "node_modules")
b. DIRS = DIRS + DIR
c. let I = I - 1
5. return DIRS
Thanks for the report. Took a bit of time before I could have a look at it, but the issue should be solved now. The code wasn't descending into subfolders when loading from within node_modules...
So, when trying to resolve module 'fbjs/lib/invariant', from React, I'm getting a no module found exception.
When debugging the module, seems like it could be related with this method.
It does not seem to mimic the NodeJS behaviour, at least according to this