duojs / duo

A next-generation package manager for the front-end
3.43k stars 118 forks source link

Supporting npm packages #456

Open matthewmueller opened 9 years ago

matthewmueller commented 9 years ago

One simple (but not most efficient) way to support NPM packages would be to use the browserify CDN (with standalone), run derequire on it, then re-wrap in Duo.

dominicbarnes commented 9 years ago

With the change @stephenmathieson has made in duojs/package#37, I think we should just add a proper npm provider. The above sounds brittle, especially if you use multiple npm packages.

matthewmueller commented 9 years ago

Would this address building nested dependencies? The browserify CDN automatically builds all the dependencies and bundles them.

dominicbarnes commented 9 years ago

Wouldn't each npm package included have it's entire dependency tree bundled? Imagine I include 2 npm modules that have overlapping dependencies, wouldn't it duplicate a lot since each package would be bundled independently?

matthewmueller commented 9 years ago

Not necessarily. iirc NPM prunes the dependencies and will move them up a level if two dependencies require the same dependency. Not sure if we could catch it before it does this though. On Tue, Apr 7, 2015 at 22:00 Dominic Barnes notifications@github.com wrote:

Wouldn't each npm package included have it's entire dependency tree bundled? Imagine I include 2 npm modules that have overlapping dependencies, wouldn't it duplicate a lot since each package would be bundled independently?

— Reply to this email directly or view it on GitHub https://github.com/duojs/duo/issues/456#issuecomment-90802016.