Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-08-26 04:45:48 +0400
committerisaacs <i@izs.me>2010-08-26 05:01:25 +0400
commit11d2d35e2c5f946932f4936e5f6c2a3f7ee51bf1 (patch)
treeb0a07d1b7fe05dd3faf932c62a58aeff6cb8895b
parent44bde949a2dd691ee725deb27a43f96b43e1dd85 (diff)
Don't put the bundle path in require.paths over and over again.
-rw-r--r--lib/bundle.js4
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"
})