Is there an alternative to Browserify? [closed]

主宰稳场 提交于 2021-02-04 05:11:55

问题


I want to generate client side JavaScript from Node.js. I found Browserify, but is there any other alternative to Browserify ?


回答1:


Correct me if I'm wrong. As I understand it browserify is used to pre-process JavaScript into a format in which the browser can understand it. It grabs all the code which is "require'd" in Node and bungs it all in one file. Not sure if it does any other pre-processing.

This is a pre-processing approach to modular JavaScript.

Dynamic modularisation is achieved via RequireJs or SystemJs. SystemJs is the new approach that makes the new ES6 modularisation approach available now. It is awesome in my opinion. One might consider it a polyfill???

Note that SystemJs is both promoted by babel - the EcmaScript 6to5 pre-processor (for definite) - and Angular2 (I believe)

The benefit of dynamic modularisation v pre-processing is that pre-processing loads all your code whether you use it or not. Dynamic modularisation only loads code when needed - e.g. on a button click. Thus you do not load all your code up front. This reduces page weight and frees up resources. The problem with dynamic modularisation is that you have to code "when" code is loaded. It can also be a pain doing the initial hookup. When using pre-processing you don't have all these concerns.

Hope that helps




回答2:


besides browserify you can try webpack or requirejs



来源:https://stackoverflow.com/questions/34438378/is-there-an-alternative-to-browserify

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