问题
With npm 3 coming with a flat(-ish) dependency structure, do we use Bower in future or just npm 3 when its released ?
npm is most commonly used for managing Node.js modules, but it works for the front-end too when combined with Browserify and/or $ npm dedupe.
Bower is created solely for the front-end and is optimized with that in mind. The biggest difference is that npm does nested dependency tree (size heavy) while Bower requires a flat dependency tree (puts the burden of dependency resolution on the user)
merge bower into npm
npm3
npm-and-front-end-packaging
回答1:
npm 3 coupled with browserify or webpack is the way to go now. Multiplying package manager in your project make your workflow harder.
Install npm 3 today with:
npm install -g npm@latest
回答2:
Bower is mainly for frontend libraries, which do not have dependencies of their own, thus in bower, flat structure is a limitation, rather than a feature.
npm-3 is a smart dependency manager where dependencies can have their own secondary dependencies (sub-dependencies).
It tries to create flattened structure wherever possible, but that is not a limitation. In certain cases, it will not adhere it (for example : when you need multiple version of a dependency)
来源:https://stackoverflow.com/questions/32087425/what-is-the-difference-between-npm-3-vs-bower