使用 gulp-uglify 丑化 JS IIFE 后缺少代码

Missing code after uglifying JS IIFE with gulp-uglify

所以我开始使用 Gulp 来自动化我的工作流程,我一直在玩弄它但是我 运行 在执行连接和丑化多个文件的任务时使用了一些代码在 IIFE 里面丢失了。要连接使用 gulp-usref.

  // a-file.js
  (function() {
    'use strict';
    console.log('a-file');
    var variableA = 'variable a';
  })();

  // anotherfile.js
  (function() {
    'use strict';
    console.log('another-file');
    var variableB = 'variable b';
    var myFunction = function() {
      return 'return function value';
    };
  })();

   // main.js
  (function() {
    'use strict';
    console.log('Hello main');
    var variableC = 'variable c';
  })();

  // gulpfile.js
  gulp.task('useref', function() {
     return gulp.src('app/*.jade')
       .pipe(jade({pretty: true}))
       .pipe(useref())
       .pipe(gulpIf('*.js', uglify()))
       .pipe(gulpIf('*.css', cssnano()))
       .pipe(gulp.dest('dist'))
  })

当我 运行 任务文件被连接和丑化但 variableA, variableB, variableC and myFunction 没有出现,只有 console.log 的。

!function(){"use strict";console.log("a-file")}(),function(){"use strict";console.log("another-file")}(),function(){"use strict";console.log("Hello main")}();

我漏了一步?或者我该如何解决这个问题?

Uglifiers,包括 gulp-uglify,删除未使用的代码。