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

微前端如何支持ice主应用? #679

Open
2 tasks done
xmsz-stu opened this issue Aug 12, 2024 · 5 comments
Open
2 tasks done

微前端如何支持ice主应用? #679

xmsz-stu opened this issue Aug 12, 2024 · 5 comments

Comments

@xmsz-stu
Copy link

Clear and concise description of the problem

我的主应用是v2.ice.work,子应用是modern.js
然后现在微前端的路由跳转有问题,只有刷新页面才可以匹配,其他情况下路由跳转都无效,
我觉得应该是ice自己也拦截除了history导致无效

Suggested solution

支持ice

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@xmsz-stu xmsz-stu changed the title 支持ice主应用跨级啊 微前端如何支持ice主应用? Aug 13, 2024
@xmsz-stu
Copy link
Author

如果我延迟注入normalAgent就会有效果,说明history的拦截时间可能冲突了
有没有临时解决办法?
比如暴露出normalAgent,或者主动传入history对象

@xmsz-stu
Copy link
Author

如果我延迟注入normalAgent就会有效果,说明history的拦截时间可能冲突了 有没有临时解决办法? 比如暴露出normalAgent,或者主动传入history对象

延迟注入,第一次切换到子应用可以,但是第二次就会提示

index.js:81 [Garfish warning]:  Invalid module content: 微号管理, you should return both render and destroy functions in provider function.
index.js:87 Uncaught (in promise) 
Error: [Garfish warning]: "provider" is "undefined".


    at index.js:87:13
    at processError (index.js:71:5)
    at error (index.js:85:3)
    at assert (index.js:137:5)
    at App.checkAndGetProvider (index.js:1000:7)
    at async App.mount (index.js:657:24)
    at async call (index.js:478:24)
    at async active (index.js:491:15)
    at async index.js:289:5
    at async asyncForEach (index.js:94:5)

@xmsz-stu
Copy link
Author

Error: [Garfish warning]: "provider" is "undefined".

如果把cache设置为true就不会提示了

现在就是注入的时机不知道该是什么时候

@xmsz-stu
Copy link
Author

xmsz-stu commented Aug 13, 2024

好像热更新也不行

如果设置output的一些属性,热更新就完全失效
如果没有设置output,则

  • 有些时候,更新后后刷新整个页面
  • 有些时候,热更新有效果,但是样式全没有了

独立运行时正常,说明可能和主应用冲突了或者判断有问题?

反正开发环境千万不要externals react, 否则热更新100%不可用

@xmsz-stu
Copy link
Author

xmsz-stu commented Aug 14, 2024

还有样式加载问题 每次热更新

  • 不会加载unocss更新的样式,重新刷新后生效(因为unocss生成的文件在)

原因可能是

  • hmr会更新link的样式,也会同时更新主应用的link造成重新加载,所以会出现重复加载部分样式,不知道怎么解决
  • 有些样式并不是通过link插入的,而是style,hmr刷新的又是link的样式?

子应用独立运行,也很奇怪,热更新

  • 也会重新加载依赖样式,也是部分重新加载,而且和子应用里加载的依赖样式还不同

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

1 participant