umijs / qiankun

📦 🚀 Blazing fast, simple and complete solution for micro frontends.
https://qiankun.umijs.org
MIT License
15.71k stars 2k forks source link

子应用样式style被加到了主应用的header里面 #1906

Open binyellow opened 2 years ago

binyellow commented 2 years ago

What happens?

子应用样式style被加到了主应用的header里面,然后影响了主应用的样式

Mini Showcase Repository(REQUIRED)

Provide a mini GitHub repository which can reproduce the issue.

How To Reproduce

  1. lerna bootstrap安装依赖
  2. lerna run dev启动应用
  3. 访问localhost:3000,注意观察li和h1样式
  4. 点击左侧li>vue,观察到主应用的header被插入了一条style,同时li和h1样式被覆盖

Context

gongshun commented 2 years ago

即使不插入到 header 中(插入到子应用所在的容器),子应用的样式一样是全局生效的,样式污染问题始终存在

chenzhq commented 2 years ago

主应用和子应用的样式污染是正常的(目前版本)。但这个问题的重点是,子应用之间也互相影响样式了,因为样式加到外层head中后,切换到其它子应用,style标签也不会被移除。

即使不插入到 header 中(插入到子应用所在的容器),子应用的样式一样是全局生效的,样式污染问题始终存在