javascript - React Native Web - 当前未启用对实验性语法“jsx”的支持
问题描述
我已经尝试了以前的答案中提到的但无法解决错误:
SyntaxError:node_modules\react-native-gifted-chat\lib\GiftedChat.js:当前未启用对实验性语法“jsx”的支持 (337:27):
babel.config.js:
module.exports = function (api) {
const presets = ["@babel/preset-env", "@babel/preset-react"];
const plugins = ["@babel/plugin-transform-runtime"];
/** this is just for minimal working purposes,
* for testing larger applications it is
* advisable to cache the transpiled modules in
* node_modules/.bin/.cache/@babel/register* */
api.cache(false);
return {
presets,
plugins,
};
};
包.json
"devDependencies": {
"@babel/plugin-syntax-jsx": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5"
}
我完全不知道这里出了什么问题。预设已安装,插件已安装但没有任何效果,我得到同样的错误。
解决方案
推荐阅读
- android - MVP 架构
- sql - 您如何并排“加入”多个 SQL 数据集(彼此不链接)?
- javascript - 为什么无阻塞节点会减少 I/O 总时间?
- scala - circe 自动推导 - 与进口作斗争
- javascript - 在 url (Javascript) 上添加部分时无法识别 Cookie
- mysql - 是否可以从 MYSQL 中的存储过程中返回多个表
- c# - 等效于 php 中的 C# Encoding.UTF8.GetBytes
- javafx - 重置无限 JavaFX RotateTransition
- ruby-on-rails - Ruby on Rails 控制器实例变量未共享
- functional-programming - 如何使用 [@ocaml.warning "-30"] 隐藏警告 30