javascript - performance surprises with browserify -


i'm migrating build process list of concatenated scripts browserify.

old version

  • all vendor scripts bower
  • build: concatenate scripts , minify (uglifyjs) results

new version

  • as possible, use npm modules
  • when not available, fetch them bower , use debowerify
  • build: browserify (and +watchify) bundle, minify (uglifyjs) results

what surprised me:

  • my reload time watchify 3s, not lot?
  • the final script 3 times bigger previous builds, whereas modules same. erratum : not true, see below

do think wrong build?


edit

there no increase of script size. did not measure correctly, because saw of old version gzipped size. i'm leaving here people figure out more if fooled in similar way.

the problem of bundling time still remains.


i'm using gulp, here relevant part of gulpfile.js:

var gulp = require('gulp'); var gutil = require('gulp-util');  var browserify = require('browserify'); // bundles commonjs modules (require('...')) file browser. var watchify = require('watchify'); // fast watch browserify var sourcemaps = require('gulp-sourcemaps'); // creating sourcemaps var uglify = require('gulp-uglify'); // js minification var jade = require('gulp-jade'); // jade compilation   function scriptsbundle(watchified){   var b = browserify({     entries: ['./src/frontend/app.js'],     debug: true,     transforms: [       //bngannotate     ]   });   if(watchified){     b = watchify(b);   }   b.transform('debowerify');   return b; }  function buildscripts(bundleable){   return bundleable.bundle()     .pipe(source('app.js'))     .pipe(buffer())     //.pipe(sourcemaps.init({loadmaps: true}))     //.pipe(uglify())     .on('error', gutil.log)     //.pipe(sourcemaps.write('./'))     .pipe(gulp.dest(frontend_public_dir)); }  gulp.task('scripts-watchified', function () { // reloadable bundling, , that's takes 3s every reload   var bundleable = scriptsbundle(true);   var build = _.partial(buildscripts, bundleable);   bundleable.on('update', function (e) {     console.log("bundle update", e);     return build();   });   bundleable.on('log', gutil.log);   //bundleable.on('update', browsersync.reload);    return build(); }); 


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -