Posts

Showing posts with the label Babel Preset Env

Confused About UseBuiltIns Option Of @babel/preset-env (using Browserslist Integration)

Answer : 1) Do I need to use that useBuiltIns: "entry" option? Yes, if you want to include polyfills based on your target environment. TL;DR There're basically 3 options for useBuiltIns : "entry" : when using this option, @babel/preset-env replaces direct imports of core-js to imports of only the specific modules required for a target environment. That means you need to add import "core-js/stable"; import "regenerator-runtime/runtime"; to your entry point and these lines will be replaced by only required polyfills. When targeting chrome 72, it will be transformed by @babel/preset-env to import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; "usage" : in this case polyfills will be added automatically when the usage of some feature is unsupported ...