Skip to content

Instantly share code, notes, and snippets.

@aneurysmjs
Last active October 17, 2019 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aneurysmjs/5a8747fe3d59c910bb9a398cf8678e4c to your computer and use it in GitHub Desktop.
Save aneurysmjs/5a8747fe3d59c910bb9a398cf8678e4c to your computer and use it in GitHub Desktop.
bundle-tricks
// .babelrc
{
"presets": [
[
"@babel/preset-env",
{
// this tells @babel "hey, don'y change any of the modules, let Webpack handle it
"modules": false
// you only get the individual pollyfill that you need
"useBuiltIns": "usage"
}
],
],
}
// "useBuiltIns": "usage"
// a.js
var a = new Promise();
// b.js
var b = new Map();
// Out (if environment doesn't support it)
import "core-js/modules/es.promise";
var a = new Promise();
//
import "core-js/modules/es.map";
var b = new Map();
// Out (if environment supports it)
var a = new Promise();
var b = new Map();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment