diff options
-rw-r--r-- | lib/bundle.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bundle.js b/lib/bundle.js index 2d8511883..2fb0b3022 100644 --- a/lib/bundle.js +++ b/lib/bundle.js @@ -55,7 +55,9 @@ function cleanup (er_, cb) { function writeBundleShim (location, depNames, cb) { var data = "// generated by npm, please don't touch!\n" - + "require.paths.unshift(__dirname)\n" + + "var i = require.paths.indexOf(__dirname)\n" + + "if (i && i + 1) require.paths.splice(i, 1)\n" + + "if (i) require.paths.shift(__dirname)\n" + depNames.map(JSON.stringify).map(function (d) { return "exports["+d+"] = require("+d+")\n" }) |