umijs / qiankun

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

[Bug or Feature] Could't call `navigaor.serviceWorker.register` in Child App #2950

Open eryue0220 opened 2 months ago

eryue0220 commented 2 months ago

What happens?

While calling navigator.serviceWorker.register in Child App, it will cause an error and make the whole app down. On the other hand, the location.origin in child app's code will change to the main's

Mini Showcase Repository(REQUIRED)

https://github.com/eryue0220/qiankun-test-demo

How To Reproduce

Steps to reproduce the behavior:

  1. cd qiankun-test-demo
  2. run cd main && npm i && npm start to start main app
  3. run cd child && npm i && npm start to start child app
  4. visit http://localhost:3000 in browser

Expected behavior

  1. Calling navigator.serviceWorker.register API in child app will not cause an error;
  2. location.origin should points at its real app.

Context