Answer the question
In order to leave comments, you need to log in
How to use Babel polyfills?
I installed babel, it works but not completely, it turned out that to convert closest you need to add a polyfill, I installed it with the command npm install babel-polyfill
, but you need webpack to use it, I installed it, launched it, and got errors, what's the problem? I wrote package.json
in the
original jsrequire("babel-polyfill");
{
"name": "",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"element-closest-polyfill": "^1.0.4"
},
"devDependencies": {
"webpack": "^5.44.0",
"webpack-cli": "^4.7.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC"
}
{
"presets": [
[
"@babel/env",
{
"targets": {
"ie": "10",
"edge": "12",
"firefox": "28",
"chrome": "29",
"opera": "12.1",
"safari": "6.1",
"android": "4.4"
},
"useBuiltIns": "usage",
"corejs": "3.6.5"
}
]
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question