What is the difference between npm 3 vs Bower?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 13:40:12

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!