browserify总结

一。browserify 简介

browserify is a tool for compiling node-flavored commonjs modules for the browser

You can use browserify to organize your code and use third-party libraries even if you don't use node itself in any other capacity except for bundling and installing packages with npm.

The module system that browserify uses is the same as node, so packages published to npm that were originally intended for use in node but not browsers will work just fine in the browser too.
官网链接
简介就直接从官网上copy过来,重点信息都加粗了。

二。学习总结

browserify 可以使开发前端组件就像开发node后端一样----使用require引入依赖(无缝使用了node模块系统的优点),甚至可以使用node里面才有的东西(比如Buffer对象,events,crypto等)。然后最终将编写的模块编译成一个js文件。

我的观点

对于模块化

browserify在他的handbook里面论述了前端模块系统(window globals,concatenate,AMD)的优缺点. 其中对挂载在window对象上这种方式的批判理由是:

Instead of a module system, each file defines properties on the window global object or develops an internal namespacing scheme.
This approach does not scale well without extreme diligence since each new file needs an additional

posted @ 2015-11-20 18:05  yyrdl  阅读(1502)  评论(1编辑  收藏  举报