javascript - RequireJs VS Browserify which one is best for JS optimization -


i developing single page application angularjs. js optimization have 2 options 1 requirejs , 1 browserify.

which 1 best angularjs single page application.

please consider easy of implementation,support, best performance etc

please suggest

.state('root.home',{         url: '/index.html',         views: {             'header': {                 templateurl: 'modules/header/html/header.html',                 controller: 'headercontroller'             },                       'content-area': {                 templateurl: 'modules/home/html/home.html',                 controller: 'homecontroller'             },             'footer': {                 templateurl: 'modules/common/html/footer.html',                 controller: 'footercontroller'             }         },         data: {             displayname: 'home',          }     }) 

in index.html page loading needed javascripts , unwanted scripts.which 1 best approach load wanted js file home module angularjs ui rooter. please give 1 example ui rooter

a couple thoughts:

  • browserify's ease of use wins out. use require() , module.exports, in node module; easier require's definition , dependency injection.
  • performance in terms of cpu time both negligible. far size goes - require needs load bootstrap, browserify builds standalone bundles. however, browserify import node libraries default tends bump size up.
  • notably large apps: requirejs allows transparent asynchronous loading of scripts. browserify not. if have large app want load incrementally, may factor.
  • notably: browserify lets import isomorphic node.js modules. since you're using angular, app won't isomorphic, there's wider body of resources take advantage of (and can brought in simple npm install)

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -