aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.69k stars 3.98k forks source link

[CLOSED] Compiled nested dependencies get installed multiple times #497

Closed ngokevin closed 8 years ago

ngokevin commented 8 years ago

Issue by cvan Monday Sep 21, 2015 at 19:50 GMT Originally opened as https://github.com/aframevr/aframe-core/issues/170


From @nickdesaulniers in https://github.com/MozVR/vr-components/issues/10:

fsevents@0.3.8 gets compiled 3 seperate times. utf-8-validate@1.1.0 twice bufferutil@1.1.0 twice

I think there's a way to share/squash deps on semver matches.

Also see https://github.com/npm/npm/issues/9699

ngokevin commented 8 years ago

Comment by cvan Monday Sep 21, 2015 at 19:51 GMT


I think peerDependencies are supposed to solve this. But since peerDependencies are evidently getting deprecated in npm 3, you have to start explicitly requiring them as dependencies or devDependencies.

I tried adding them as devDependencies, and it saved 10 seconds in a fresh npm install:

npm i  53.12s user 19.47s system 165% cpu 43.935 total
npm i  43.23s user 15.84s system 144% cpu 40.743 total
diff --git a/package.json b/package.json
index 46d2e22..8237375 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,10 @@
     "replace": "^0.3.0",
     "semistandard": "^7.0.2",
     "snazzy": "^2.0.1",
-    "uglifyjs": "^2.4.10"
+    "uglifyjs": "^2.4.10",
+    "utf-8-validate": "^1.1.0",
+    "bufferutil": "^1.1.0",
+    "fsevents": "^0.3.8"
   },
   "scripts": {
     "start": "npm run dev",
ngokevin commented 8 years ago

Comment by nickdesaulniers Monday Sep 21, 2015 at 20:57 GMT


see the update from Forrest, npm 3 solves this by default

ngokevin commented 8 years ago

Comment by cvan Monday Sep 21, 2015 at 21:04 GMT


see the update from Forrest, npm 3 solves this by default sweeeet!