gloriasoft / veaury

Use React in Vue3 and Vue3 in React, And as perfect as possible!
MIT License
1.27k stars 81 forks source link

vite+vue3+ts作为基础,加入reaact, react的tsx组件报错且无法正常渲染改为jsx可以正常展示,请问是有啥东西少配置了吗 #134

Closed PengGangGui closed 2 months ago

PengGangGui commented 2 months ago

"react": "^18.3.1", "react-dom": "^18.3.1", "veaury": "^2.4.1", "vue": "^3.4.29", 微信截图_20240709170640 微信截图_20240709170523 微信截图_20240709170538 微信截图_20240709170615

devilwjp commented 2 months ago

@PengGangGui 这个问题的根因是因为vue3+vite+ts项目中的tsconfig.json中引用了vue的一些特殊配置,将jsxImportSource的值改成了vue,导致vite中的react插件的jsxImportSource的值也被修改。

快速解决方案是对vite.config.ts中的veaury插件多加一个配置,如下:

plugins: [
    veauryVitePlugins({
      type: 'vue',
      reactOptions: {
        jsxImportSource: 'react'
      },
    })
  ],

长期解决方案是veaury会弥补这个问题,预期再2.4.2版本修复

devilwjp commented 2 months ago

@PengGangGui 2.4.2已发布

PengGangGui commented 1 month ago

感谢