babeljs - Is there any practical difference between using babel-runtime and the babel-polyfill when *not* developing a library? (e.g. web application) -


it's in title, really.

in babel documentation, there following line on page describing babel-runtime

another purpose of transformer create sandboxed environment code. built-ins such promise, set , map aliased core-js can use them seamlessly without having require globally polluting polyfill.

the polyfill that, separate javascript file included shims missing things.

i've tested polyfill vs. using babel-runtime build tools (webpack), , files slightly smaller when use babel-runtime.

i'm not developing library or plugin, web application, , not care global scope being polluted. knowing this, other smaller final filesize, there other practical benefits or points in using runtime on polyfill?

if don't care polluting global scope, polyfill better option: runtime not work instance methods such [0, 1, 2].includes(1), while polyfill will.

the main difference between 2 polyfill pollutes global scope, , works instance methods, while runtime not pollute global scope , not work instance methods.

the polyfill not allow include 2 separate versions of code. problem if 2 separate polyfills being required/imported somewhere in code.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -