gloriasoft / veaury

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

你好,在这个项目中引用veaury2.3.12运行报错,请问能帮忙解决下吗谢谢 #87

Closed jimoguilai closed 4 months ago

jimoguilai commented 1 year ago

项目代码:https://gitee.com/dxz-open/vue-next-admin 在/src/views/lowercode/amis/ 下想试试vue3中引用react组件,但是vite中加了 // type设为vue时, 所有名为react_app目录中的文件的jsx将被react jsx编译,其他文件里的jsx将以vue jsx编译 veauryVitePlugins({ type: 'vue' }) 启动就会报错,注释掉又能正常运行,请帮忙解决下谢谢

devilwjp commented 1 year ago

@jimoguilai

配置如下

plugins: [
            veauryVitePlugins({
                type: 'vue'
            }),
            vueSetupExtend(),
            viteCompression(),
            JSON.parse(env.VITE_OPEN_CDN) ? buildConfig.cdn() : null,
        ],

然后带有jsx的文件要用.jsx后缀命名

jimoguilai commented 1 year ago

@devilwjp 大佬不行哦,就master分支的代码,我在vite.config.ts就这么配置的

zhangHongEn commented 1 year ago

@jimoguilai 修改react_app/Basic.js为Basic.jsx后缀

jimoguilai commented 1 year ago

@zhangHongEn 不是,还没到这一步,就vite.config.ts里配置了plugins: [ veauryVitePlugins({ type: 'vue' }), vueSetupExtend(), viteCompression(), JSON.parse(env.VITE_OPEN_CDN) ? buildConfig.cdn() : null, 后,运行项目 npm run dev就报错了

zhangHongEn commented 1 year ago

@jimoguilai 去掉veauryVitePlugins和basic.js仍然报错, 先配置好基础vue环境