> Am Montag, 2. Juni 2014 19:48:51 UTC+2 schrieb CoolAJ86: > >> In my wildest dreams there is a universe in which a future version of npm >> versions packages in a global node_modules folder like this: >> > this would be a nightmare >
False. It's a nightmare when it's done the old ruby way where versioning isn't considered. > >> node_modules/[email protected]+aef123/package.json >> > npm already does a boatload of dependency resolution, so duplicate packages bloat memory and disk space (which means load times - normally not that important, but sometimes is). Since each module would have a specific version it would essentially being doing the same work it already does, but not all over the place. When I haven't rf -rf'd old projects for a while, my node_modules directories grow to several GBs. The only nightmarish thing would be the singleton problem. Singletons are bad because strange strang things start happening when you run multiple apps in a single process (vhost-ing, for example) That said having an npm rmrf-the-test-and-examples-and-hundreds-of-useless-megabytes-that-i-dont-use option might solve my gripe decently well. >> But with the way many authors currently treat modules, there's still a >> problem there: >> Many modules give you singletons by default and some have no way of >> creating instances, which means that the only true way to create an >> instance is to have a separate copy of the code. >> >> which is ok. many modules don't have state (logic should be singleton) or > encapsulate resources which you would wan't to be present once only in your > app anyway, like db connections. However, if there is a module, that > shouldn't be a singleton, then open an issue and make a pr :) > Word. Anyway, overloading node's require isn't that difficult if I understand correctly. I've considered writing a wrapper around npm that does the global package management, but alas, it's on the back burner of good ideas that I'll probably never have time for. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAGsdtOe%3DFYHmxcrov1JErjJhBuFcoM_8TcY-01HbEV2xq1FXNA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
