ngryman / gulp-bro

:punch: gulp + browserify + incremental build, done right.
MIT License
122 stars 13 forks source link

Update gulp-bro away from @babel/polyfill to use core-js natively #65

Open ecDusty opened 4 years ago

ecDusty commented 4 years ago

Hi Gulp-bro team.

I'd like to ask if you're ever going to update gulp-bro so it no longer uses the deprecated dependency of @babel/polyfill?

Thanks for your great work with this plugin. It's fantastic!

ngryman commented 4 years ago

Hey, here is the 1-man-team, I wish we were a team 😄

Unfortunately I don't really have time to invest in this project currently, so any PR is warmly welcomed. Thanks!

ecDusty commented 4 years ago

Well you've made a brilliant plugin, it's standard in all my Dev builds. If I had the skill to this I would definitely try. Thanks for the follow up!

ngryman commented 4 years ago

@ecDusty Thanks!

Which version of gulp-bro are you using? The latest one is 2.0.0 and bumped all Babel dependencies, there's no @babel/polyfill anymore. So it might just be about upgrading to the latest version 🤞

ngryman commented 4 years ago

Oh also, Babel is only used to transpile the tests. gulp-bro itself is written in ES5 and is not transpiled.

ecDusty commented 4 years ago

@ngryman So question then. gulp-bro's use of babel to compile ES6 code to ES5 is the issue?

Or is there a way to have babel use it's latest version of core-js instead. I'm still learn with gulp & gulp-bro so any advise would be greatly appreciated. Maybe the issue is with my gulp setup.

He's my gulp function that compiles my projects JS:

const js = () =>
    src(`${config.app}/js/*.js`)
        .pipe(bro({
            debug: true,
            transform: [
                babelify.configure({
                    presets: [
                        [
                            '@babel/preset-env',
                            { useBuiltIns: 'usage' }
                        ]
                    ]
                })
            ],
        }))
        .pipe(gulpif(global.syncWatching, cached('js')))
        .pipe(buffer())
        .pipe((config.env === 'production')
            ? uglify()
            : nada())
        .pipe(dest(`${config.distApp}js/`))
        .pipe(config.env === 'localDev'
            ? browserSync.stream()
            : nada());

The nada() script just allows stream to keep flowing, when not using browser sync.

I'm just looking to get my gulp automation toolkit upgraded to the stable version of babel. But i'm not sure how.

Any input is very much appreciated, though I know this is kind of outside the scope of your npm package.

ngryman commented 4 years ago

Sure no worries, I can try to help. My first guess is that it's related to babelify. What version are you using?

In their docs, they mention to install babelify and @babel/core:

$ npm install --save-dev babelify @babel/core

Can you try that to see if it resolves your issue?