ice-lab / icestark

:tiger: Micro Frontends solution for large application(面向大型应用的微前端解决方案),站点国内镜像:https://icestark.gitee.io
https://micro-frontends.ice.work
MIT License
2.04k stars 174 forks source link

模版创建微应用,内路由跳转找不到 #711

Closed Gallado closed 10 months ago

Gallado commented 10 months ago

npm init ice icestark-child @icedesign/stark-child 模版创建的微应用。 通过fetch主应用挂载 模版创建的子应用 { path: '/childAppR', title: 'childAppR', sandbox: true, loadScriptMode: 'fetch', scriptAttributes: ["crossorigin=anonymous"], // Angular app demo: https://github.com/ice-lab/icestark-child-apps/tree/master/child-common-angular

entry: 'http://localhost:3003/',

/ url: [ 'http://localhost:3003/css/main.css', 'http://localhost:3003/js/main.js', ],/ } 为什么可以显示,点击子应用内部页面跳转模版详情,就报找不到子应用跳转路由的js 和css 文件

Refused to execute script from 'http://localhost:3333/js/p_list-index.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

image

ClarkXia commented 10 months ago

确认下 'http://localhost:3333/js/p_list-index.js' 的网络请求是否正常返回 js 资源

ClarkXia commented 10 months ago

http://localhost:3003/ 加载资源为 3333 端口,需要配置下 devPublicPath 参考 https://micro-frontends.ice.work/docs/faq/#%E5%BE%AE%E5%BA%94%E7%94%A8-bundle-%E5%8A%A0%E8%BD%BD%E5%A4%B1%E8%B4%A5