javascript - Minify only used functions with gulp -


minify used functions gulp ?

/** file.js **/

export function onesample (){  return 1*1 }  export function twosample (){  return 1*1 } 

/** main.js **/

import {onesample} './file' 

/** main.min.js **/

export function onesample (){  return 1*1 } 

my gulp task:

gulp.task('js', function () {     return gulp.src('www/js/main.js')         .pipe(browserify())         .pipe(uglifyjs({                 compress: {                     unused: true                 }         }))         .pipe(concat('main.min.js'))         .pipe(gulp.dest('platforms/www/js')) }); 

gulp function , sample files above. i'm trying here have onesample() function in main.min.js build, did not it.

only minimized structure needed adding imported functions.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -