下面是我的babel.config.js,它引发错误export 'jsx' (imported as '_jsx') was not found in 'react/jsx-runtime' (possible exports: __esModule)
但是当把chrome:54改为chrome: 74时,没有抛出错误
我希望我的应用程序是支持chrome:54(chrome最小版本支持es6),我该怎么做?
module.exports = {
presets: [
["@babel/preset-env", {
"useBuiltIns": "usage",
"corejs": 3, // or 2,
"targets": {
"chrome": "54"
},
"exclude": ["@babel/plugin-transform-regenerator", "@babel/plugin-transform-arrow-functions"]
}],
["@babel/preset-react", {
"runtime": "automatic"
}]
]
}
my Babel deps:
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.13.13",
"babel-loader": "^8.2.2",
我找到解决方案,babel忽略一些深度将修复这个错误
参见https://stackoverflow.com/a/69717337/6011193