Tencent / wujie

极致的微前端框架
https://wujie-micro.github.io/doc/
Other
4.16k stars 596 forks source link

子应用在CDN中引入了地图框架Cesium,加载子应用时报错DOMException: Failed to construct 'Worker': Script at 'http://localhost:9081/cdn/cesium/Workers/cesiumWorkerBootstrapper.js' cannot be accessed from origin 'http://localhost:8080'. #873

Open zGISer opened 4 months ago

zGISer commented 4 months ago

报错信息 DOMException: Failed to construct 'Worker': Script at 'http://localhost:9081/cdn/cesium/Workers/cesiumWorkerBootstrapper.js' cannot be accessed from origin 'http://localhost:8080'.

主应用是8080,cdn在9081上,9081的其中一个node_module依赖,是自己开发的,需要调用9081的cdn中cesium的脚本方法时报错,但是应该是从9081到9081的引用不知道为什么会报错8080到9081似乎是跨域的报错,导致脚本无法调用。

错误截图 image

WXperia commented 4 months ago

这个地址改成 8080端口,http://localhost:9081/cdn/cesium/Workers/cesiumWorkerBootstrapper.js,主应用上开个遇到cdn就转发到9081的代理就行