orcunsaltik/gulp-rollup-2

this.push is not a function

MTTTM opened this issue · 0 comments

MTTTM commented

nhandledPromiseRejectionWarning: TypeError: this.push is not a function
at ../../node_modules/gulp-rollup-2/index.js:233:30
at async Promise.all (index 1)

const { src, dest } = require('gulp');
const babel = require('gulp-babel');
var uglify = require('gulp-uglify');
const gru2 = require('gulp-rollup-2').rollup;
const a=function (cb) {
  src("./libs/index.js")
        .pipe(babel({
          "presets": [
          [
            "@babel/preset-env",
            {
              "useBuiltIns": "entry",
              "corejs": '3',
              "targets": '> 1%,last 2 versions,not ie <= 11',
            }
          ]
        ]
        }))
        .pipe(gru2({
              input: 'libs/index.js',
              external: ['window'],
              cache: false,
              output: [
                {
                        file: 'index.umd.js',
                        name: 'index.umd', 
                        format: 'umd',
                       globals: {window: 'window'}
                },
                {
                      file: 'index.es.js',
                      name: 'index.es', 
                      format: 'es',
                     globals: {window: 'window'}
                }
             ]}


        ))
         .pipe(uglify())
        .pipe(dest("./dist/"))
        //iife
  cb();
}
exports.default = a;