Javascript 导出的标识符"_“违约”;未在Babel'中声明;s范围跟踪器
在升级到最新版本的TypeScript之后,我最近升级了babel配置。当我升级babel时,我现在得到了这个错误,我不知道为什么。以前有人遇到过这种情况吗?如果有,我如何修复它?决议是什么Javascript 导出的标识符"_“违约”;未在Babel'中声明;s范围跟踪器,javascript,typescript,babeljs,package.json,Javascript,Typescript,Babeljs,Package.json,在升级到最新版本的TypeScript之后,我最近升级了babel配置。当我升级babel时,我现在得到了这个错误,我不知道为什么。以前有人遇到过这种情况吗?如果有,我如何修复它?决议是什么 The exported identifier "_default" is not declared in Babel's scope tracker as a JavaScript value binding, and "@babel/plugin-transform-typ
The exported identifier "_default" is not declared in Babel's scope tracker
as a JavaScript value binding, and "@babel/plugin-transform-typescript"
never encountered it as a TypeScript type declaration.
It will be treated as a JavaScript value.
This problem is likely caused by another plugin injecting
"_default" without registering it in the scope tracker. If you are the author
of that plugin, please use "scope.registerDeclaration(declarationPath)".
The exported identifier "_default" is not declared in Babel's scope tracker
as a JavaScript value binding, and "@babel/plugin-transform-typescript"
never encountered it as a TypeScript type declaration.
我的项目中的Babel依赖项:
"@babel/core": "^7.13.8",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-numeric-separator": "^7.12.13",
"@babel/preset-env": "^7.13.8",
"@babel/preset-react": "^7.12.13",
"@babel/preset-typescript": "^7.13.0"
这个配置对我来说解决了同样的问题。把这个放进你的车里
{
"presets": [
["@babel/preset-env", { "targets": { "node": 4 } }],
"@babel/preset-typescript",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-runtime",
"transform-class-properties"
]
}
为什么目标节点是4?它可以是更高的节点版本吗?