umijs / qiankun

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

Qiankun examples #1825

Open amic81 opened 2 years ago

amic81 commented 2 years ago

Hi,

I tried your example project at https://github.com/umijs/qiankun, but looking at the sub-apps I saw that for React16 the gets to static resources go into error:

GET - http://localhost:7099/logo192.png GET - http://localhost:7099/favicon.ico

because the url and port are of the main-app (localhost:7099) instead of those of the sub-apps (localhost:7100), how is it possible to solve these error cases?

Thanks

gongshun commented 2 years ago

https://create-react-app.dev/docs/using-the-public-folder

image

You should put the picture in the src directory

amic81 commented 2 years ago

Ok, but the application structure is exactly that taken from the repository.

The files are under public and in the index.html file the favicon.icon is already linked with the public url href="%PUBLIC_URL%/favicon.ico"

image

Could it be the version of node I compile with? Which version of node do you recommend?

gongshun commented 2 years ago

<link href="/favicon.ico" rel="icon"> will not work in main app, even if its path is incorrect. Because this tag must be placed in the <head>

image

For favicon.ico,you can only insert <link href="http://localhost:7100/favicon.ico" rel="icon"> into the <head> in the mount function and remove it in the unmout.

For other pictures, you just need to put it in the src directory and use it normally