gulp-bro icon indicating copy to clipboard operation
gulp-bro copied to clipboard

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

Open ecDusty opened this issue 5 years ago • 6 comments

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!

ecDusty avatar Feb 18 '20 09:02 ecDusty

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!

ngryman avatar Feb 18 '20 15:02 ngryman

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!

ecDusty avatar Feb 19 '20 05:02 ecDusty

@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 avatar Feb 19 '20 09:02 ngryman

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

ngryman avatar Feb 19 '20 09:02 ngryman

@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.

ecDusty avatar Feb 28 '20 03:02 ecDusty

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?

ngryman avatar Mar 03 '20 08:03 ngryman