I'm using Babel 6's babel-preset-env to compile code targeted at IE10+.
{
"presets": [
["env", {
"targets": {
"browsers": ["ie >= 10"]
}
}],
"stage-3",
"react"
],
"plugins": [
"transform-class-properties"
]
}
But I'm also, separately, polyfilling the browser (using Polyfill.io) before my Babel-compiled app script runs. So I don't want babel-preset-env to inject any polyfills for modern JS APIs (Promise
, Array.from
, etc), as I've already polyfilled these, so it's a waste of bytes.
I still want babel-preset-env to compile any modern syntax down to IE10, just not to inject polyfills. But I do want it to inject regeneratorRuntime
– this is not really a polyfill, but rather a helper utility that supports Babel's approach for transforming the syntax of async functions and generators down to IE10-compatible code. Not sure if this complicates it.
I know babel-preset-env has a useBuiltIns
option (aside: I don't understand name of this option), which apparently lets you specify how you want it to add polyfills... but I'm not clear on how to tell it not to add polyfills at all (except regeneratorRuntime, if it counts that as a polyfill – not sure).
Is there a way to do that?