Performance 吞下许多文件速度很慢

Performance 吞下许多文件速度很慢,performance,gulp,gulp-concat,Performance,Gulp,Gulp Concat,因此,我有一个吞咽配置,将所有角度文件合并为一个。 以下是相关的问题 const jsPaths = [ 'src/js/**/*.js', // no more than 100 files 'node_modules/angular-google-places-autocomplete/src/autocomplete.js', 'node_modules/angular-foundation-6/dist/angular-foundation.js', 'node_modu

因此,我有一个吞咽配置,将所有角度文件合并为一个。 以下是相关的问题

const jsPaths = [
  'src/js/**/*.js', // no more than 100 files
  'node_modules/angular-google-places-autocomplete/src/autocomplete.js',
  'node_modules/angular-foundation-6/dist/angular-foundation.js',
  'node_modules/angular-slugify/angular-slugify.js',
  'node_modules/satellizer/satellizer.js',
  'node_modules/angular-toastr/dist/angular-toastr.tpls.js',
  'node_modules/angular-filter/dist/angular-filter.js'
]

gulp.task('jsbundle', function(done){
  jsbundle(done)
})

gulp.task('js', ['jsbundle'], function(){
  transpileJs()
})

function jsbundle(done){
  gulp.src(jsPaths)
  .pipe(concat('concat.js'))
  .pipe(gulp.dest('tmp'))
  .on('end', function() {
    done();
  });
}
5.04秒后完成“jsbundle” 完成的文件大约为1.5mb
我能做些什么来加快速度吗?

你可以用丑八怪轻松缩小它。 首先安装uglify并重命名:

npm install -rename gulp-uglify --save-dev 
并加上:

`function jsbundle(done){
     gulp.src(jsPaths)
    .pipe(concat('concat.js'))
    .pipe(gulp.dest('tmp'))
    .pipe(rename('concat.min.js'))
    .pipe(uglify())
   .pipe(gulp.dest('tmp'));
   .on('end', function() {
       done();
   });
}`

1.5mb是一个巨大的JS文件。您可以从CDN加载这些供应商脚本吗?它只有这么大,因为它没有缩小。我想我找到了解决的办法。当我完成修补工作时,我会把我的发现公布出来