Closed moshuying closed 1 year ago
翻遍相关issue没有看到类似的解决方案
tsx 组件在编译时不一定能看到报错,先写JSX组件处理掉报错后即可,我这边的报错是找不到deri包,尽管再package.json中有,还是需要再安装一遍(NPM背锅!)
我也遇到了这个报错,原因是因为我的tsconfig中extends了@vue/tsconfig/tsconfig.json,其中定义了jsx的编译规则:
jsxImportSource,是用于指定从哪个模块导入 JSX 工厂函数 在这个配置里,react jsx会转入vue的编译规则里,解决办法就是移除这个extends,手动添加需要的规则,最简单的版本是这样的:
{
"include": [
"env.d.ts",
"src/**/*",
"src/**/*.vue",
"vite.config.*"
],
"compilerOptions": {
"composite": true,
"types": [
"node"
],
"paths": {
"@/*": [
"./src/*"
]
}
}
}
您好,我的项目使用了 vue3和react 18。尝试在项目中使用react three fiber却一直报错