Open zzh3319 opened 3 years ago
I cloned the repo and did a fresh install and was unable to reproduce this issue.
My guess is that you have a different server running on port 8080 already, before you ran npm run serve
in the navbar. You should find any servers on port 8080 and stop them. Then run npm run serve
in the navbar. On linux/osx, you can do this:
lsof -i :8080
kill <pid>
cd coexisting-vue-microfrontends/navbar
npm run serve
@@@开发依赖安装了这个插件,解决了你描述的跨域问题 @zzh3319
"vue-cli-plugin-single-spa": "^1.0.1"
(index):1 Access to script at 'http://localhost:8080/js/app.js' from origin 'http://localhost:5000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. system.min.js:4 GET http://localhost:8080/js/app.js net::ERR_FAILED (anonymous) @ system.min.js:4 g.instantiate @ system.min.js:4 t.instantiate @ system.min.js:4 t.instantiate @ named-register.min.js:1 (anonymous) @ system.min.js:4 Promise.then (async) t @ system.min.js:4 (anonymous) @ system.min.js:4 Promise.then (async) g.import @ system.min.js:4 e.import @ system.min.js:4 t.import @ use-default.min.js:1 (anonymous) @ (index):42 (anonymous) @ single-spa.min.js:1 Promise.then (async) (anonymous) @ single-spa.min.js:1 Promise.then (async) tt @ single-spa.min.js:1 (anonymous) @ single-spa.min.js:1 Promise.then (async) Ct @ single-spa.min.js:1 Tt @ single-spa.min.js:1 (anonymous) @ (index):40 Promise.then (async) (anonymous) @ (index):33 (anonymous) @ (index):60 single-spa.min.js:1 Uncaught navbar: Application 'navbar' died in status LOADING_SOURCE_CODE: Error loading http://localhost:8080/js/app.js at HTMLScriptElement. (https://cdnjs.cloudflare.com/ajax/libs/systemjs/6.1.1/system.min.js:4:5825)