Skip to content

Commit

Permalink
fixed #44
Browse files Browse the repository at this point in the history
  • Loading branch information
s-a committed Aug 11, 2015
1 parent 0af76cf commit 63b871f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"white" : true,
"indent" : 2,
"maxdepth" : 3,
"maxcomplexity" : 7,
"maxcomplexity" : 8,
"maxparams" : 3,
"maxstatements" : 40
}
7 changes: 4 additions & 3 deletions app/require.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ Module.prototype.require = function require(name) {
console.groupCollapsed("ironNode require(\"" + name + "\")");
try{
var fn = path.basename(name);
var p = path.join(this.filename, "..");
var fn2 = (path.isAbsolute(name) ? name : this.filename);
var p = path.join(fn2, "..");

/*jump back to nearest node_modules*/
var nodeModulesLevel = checkNodeModulesLevel(this.filename);
var nodeModulesLevel = checkNodeModulesLevel(fn2);
if (nodeModulesLevel === -1){
throw "native+ fallback for `" + name + "` failed! You can try `iron-node --compile`";
}
Expand All @@ -51,7 +52,7 @@ Module.prototype.require = function require(name) {
console.warn("try native+ method `require(" + p + ");`");
result = _require.call(this, p);
} catch(e) {
console.error("error while `require(" + name + ");`", e);
console.error("error while `require(" + path.basename(name) + ");`", e);
result = _require.call(this, name);
} finally {
if (result !== null){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"dependencies": {
"commander": "^2.8.1",
"electron-prebuilt": "^0.30.4",
"electron-recompile": "^1.0.12",
"electron-recompile": "^1.0.13",
"electron-toaster": "^1.0.8",
"markdown": "^0.5.0",
"nmp": "^1.0.3",
Expand Down

0 comments on commit 63b871f

Please sign in to comment.