Add a line to the top of every js file using Gulp

Viewed 57

I'm trying to attach a line (require('@babel/polyfill')) to the top of every file. I tried to add this line manually and everything worked fine. But when I do it using gulp-header this line gives no effect. I checked that this line actually appears before it passes thru browserify, so I have no idea what's going wrong.

So, can you point me my mistake or tell another way to do it.

gulp.src(inputPath)
    .pipe(gpHeader("require('@babel/polyfill');\n"))
    .pipe(bro({
        insertGlobals: true,
        debug: isDev,
        transform: [
            babelify.configure(options)
        ]
    }))
    .pipe(gulp.dest(outputPath))

In this code i'm using gulp-bro - i's a package based on browserify.

0 Answers
Related