Babel 的新手,它主要工作得很好,但我对为什么 Babel 没有涵盖 append 方法感到困惑。这是我的 .babelrc
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": [
"> 1%"
]
},
"useBuiltIns": false,
"debug": true,
"modules": false
}
]
],
"ignore": [
"Gruntfile.js",
"dist/**",
"lib/*.min.js",
"productionJS/*.js"
],
"plugins": [
"@babel/plugin-transform-classes"
]
}
我尝试使用 useBuildIns = "entry"和 "usage"但没有任何区别。我是否需要添加更多插件或设置不同的预设来覆盖 append ?
目前,我的解决方法是使用以下链接中的 polyfill
https://developer.mozilla.org/en-US/docs/Web/API/ParentNode/append
任何提示将不胜感激
最佳答案
babel
将现代 JavaScript 语法转换为旧浏览器的向后兼容代码。 append
是一种 DOM 方法,根据 MDN 使用 polyfill docs
关于internet-explorer - Babel 不包括 append 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54524792/