Migration from preset-env
and plugin-transform-runtime
All the existig capabilities of @babel/preset-env
and @babel/plugin-transform-runtime
related to core-js
are supported by the polyfill providers implemented in this repository.
Old configuration
New configuration
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 },
"useBuiltIns" : " usage" ,
"corejs" : 3
}]
]
}
{
"targets" : { "firefox" : 42 },
"presets" : [" @babel/preset-env" ],
"plugins" : [
[" polyfill-corejs3" , {
"method" : " usage-global"
}]
]
}
Old configuration
New configuration
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 },
"useBuiltIns" : " entry" ,
"corejs" : 3
}]
]
}
{
"targets" : { "firefox" : 42 },
"presets" : [" @babel/preset-env" ],
"plugins" : [
[" polyfill-corejs3" , {
"method" : " entry-global"
}]
]
}
Old configuration
New configuration
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 }
}]
],
"plugins" : [
[" @babel/transform-runtime" , {
"corejs" : 3
}]
]
}
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 }
}]
],
"plugins" : [
" @babel/transform-runtime" ,
[" polyfill-corejs3" , {
"method" : " usage-pure"
}]
]
}
NOTE : The "Old" config doesn't support targets for polyfills, but you'll likely want to enable them by moving the targets
option to the top-level.
Old configuration (with core-js
)
New configuration
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 },
"useBuiltIns" : " usage" ,
"corejs" : 3
}]
]
}
{
"targets" : { "firefox" : 42 },
"presets" : [" @babel/preset-env" ],
"plugins" : [
[" polyfill-es-shims" , {
"method" : " usage-global"
}]
]
}
Old configuration (with core-js
)
New configuration
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 }
}]
],
"plugins" : [
[" @babel/transform-runtime" , {
"corejs" : 3
}]
]
}
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 }
}]
],
"plugins" : [
" @babel/transform-runtime" ,
[" polyfill-es-shims" , {
"method" : " usage-pure" ,
}]
]
}
NOTE : The "Old" config doesn't support targets for polyfills, but you'll likely want to enable them by moving the targets
option to the top-level.
Old configuration
New configuration
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 },
"useBuiltIns" : " usage" ,
"corejs" : 2
}]
]
}
{
"targets" : { "firefox" : 42 },
"presets" : [" @babel/preset-env" ],
"plugins" : [
[" polyfill-corejs2" , {
"method" : " usage-global"
}]
]
}
Old configuration
New configuration
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 },
"useBuiltIns" : " entry" ,
"corejs" : 2
}]
]
}
{
"targets" : { "firefox" : 42 },
"presets" : [" @babel/preset-env" ],
"plugins" : [
[" polyfill-corejs2" , {
"method" : " entry-global"
}]
]
}
Old configuration
New configuration
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 }
}]
],
"plugins" : [
[" @babel/transform-runtime" , {
"corejs" : 2
}]
]
}
{
"presets" : [
[" @babel/preset-env" , {
"targets" : { "firefox" : 42 }
}]
],
"plugins" : [
" @babel/transform-runtime" ,
[" polyfill-corejs2" , {
"method" : " usage-pure"
}]
]
}
NOTE : The "Old" config doesn't support targets for polyfills, but you'll likely want to enable them by moving the targets
option to the top-level.