Last active
October 17, 2019 09:20
-
-
Save aneurysmjs/5a8747fe3d59c910bb9a398cf8678e4c to your computer and use it in GitHub Desktop.
bundle-tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .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