Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用bun+vite时,应用初始化的问题 #1226

Open
the-pawn-2017 opened this issue May 20, 2024 · 1 comment
Open

使用bun+vite时,应用初始化的问题 #1226

the-pawn-2017 opened this issue May 20, 2024 · 1 comment

Comments

@the-pawn-2017
Copy link

问题描述(另附我找到的解决方案)

问题的具体描述
使用bun+vite初始化应用时,在template中不能再import microApp from '@micro-zoe/micro-app'
会报错:``

复现步骤

  1. 按官网例子初始化
  2. 在使用子应用的页面中,加上
<micro-app  width="100%" height="200px" name='my-appx' url='http://localhost:5173/page-resource/index.html#/' iframe></micro-app>
import microApp from '@micro-zoe/micro-app'   
microApp.setData('my-appx', {a:true)

然后出不来,控件台提示:

 [Vue warn]: Component is missing template or render function. 
  at <Anonymous width="100%" height="200px" name="my-appx"  ... > 

我发现的解决方案

  1. 在实际使用的vue文件中,把import microApp from '@micro-zoe/micro-app' 中的 microApp改个别的名字就好了。
  2. 在main.js(ts)中,配置下microApp.tagName = 'm-app',也能修好

环境信息

  • micro-app版本:1.0.0-rc.5
  • 主应用前端框架&版本:vue 3.4.19
  • 子应用前端框架&版本: vue 3.4.19
  • 构建工具&版本: bun 1.1.5 vite 5.1.4
@crazy-airhead
Copy link

继续测试了下发现 microApp.tagName = 'micro-app',其他都不用改可以。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants