How to use the polyfill
See original GitHub issueWhat’s the best way to use the polyfill? I couldn’t find the better way but to include it into glob like this:
gulp.task('default', function () {
var polyfill = './node_modules/gulp-babel/node_modules/babel-core/browser-polyfill.js'
return gulp.src(['src/**/*.js', polyfill])
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(concat('all.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
});
Is there any better way?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:8
- Comments:9 (4 by maintainers)
Top Results From Across the Web
When and How to Use Polyfills - Bits and Pieces - Bit.dev
The polyfill uses non-standard features in a certain browser to give JavaScript a standards-complaint way to access the feature.
Read more >How to use polyfill in JavaScript ? - GeeksforGeeks
A polyfill provides the functions and features that the developer expects the browser to offer by default. Polyfill was coined by Remy Sharp....
Read more >Polyfills and transpilers - The Modern JavaScript Tutorial
A script that updates/adds new functions is called “polyfill”. It “fills in” the gap and adds missing implementations. For this particular case, ...
Read more >Introduction To Polyfills & Their Usage - Medium
A polyfill (or polyfiller) is a piece of code (or plugin) that provides the technology that we, the developers, expect the browser to...
Read more >How to use polyfills in your React app - LogRocket Blog
A polyfill allows you to use features that are not supported by a browser (or a specific browser version) by adding a fallback...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This looks like it will re-compile the browser-polyfill through babel, which is probably not what you want? I’d suggest using mergeStream and then concat –
https://babeljs.io/docs/usage/polyfill/#usage-in-browser