Coder Social home page Coder Social logo

joeldenning / coexisting-vue-microfrontends Goto Github PK

View Code? Open in Web Editor NEW
615.0 13.0 142.0 3.37 MB

A repo showing separate vue apps coexisting as microfrontends with single-spa

Home Page: http://coexisting-vue-microfrontends.surge.sh/

License: MIT License

JavaScript 33.80% HTML 29.90% Vue 29.16% Makefile 7.14%

coexisting-vue-microfrontends's Issues

RangeError: Maximum call stack size exceeded

I use single-spa, and single-spa-vue to integrate some vue(vue cli3) projects. When I operate the integrated pages, the following error has occurred. Can you tell me the possible reasons? I look forward to your reply.

Uncaught (in promise) RangeError: Maximum call stack size exceeded
at RegExp.exec ()
at RegExp.[Symbol.match] ()
at String.match ()
at _t (app.js:42)
at s (app.js:42)
at c (app.js:42)
at u (app.js:42)
at s (app.js:42)
at c (app.js:42)
at u (app.js:42)

跨域了,这么办呢

(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)

vuex

Is it okay to use vuex in a project by referring to vue-router?
Is there anything to pay attention to?

Question: New Example Repo

You mention that the newer example repo better reflects the micro frontend architecture and is encouraged to use.

Can you explain the primary architectural differences between this example and the newer example? What are some of the biggest or most significant changes?

Thank you

The superposition of CSS and JS

When I switched apps, the CSS and JS of other apps that used to be active remained in the head.

I think we should remove the CSS and JS of other apps and keep only the current active's

error3
Multiple Vue instances in the same document need to avoid global variable pollution, global monitoring pollution, style pollution and so on. Access specifications need to be formulated.

'app-name' died in status LOADING_SOURCE_CODE: "does not export an unmount function or array of functions"

When dynamically loading vue cli app using import statement
singleSpa.registerApplication(' app-3', () => import (/* webpackIgnore: true */'http://localhost:8080/app.js'), pathPrefix('/app3'));

causes following exception:
Uncaught Error: 'app-3' died in status LOADING_SOURCE_CODE: "does not export an unmount function or array of functions"

My sample vue main.js file looks like this:
`import Vue from vue
import App from './App.vue'
import singleSpaVue from 'single-spa-vue';
Vue.config.productionTip = true
const vueLifecycles = singleSpaVue({
Vue,
appOptions: {
render: (h) => h(App)
},
});

export const bootstrap = vueLifecycles.bootstrap;
export const mount = vueLifecycles.mount;
export const unmount = vueLifecycles.unmount;
`

Coexisting vue2 and vue3

Is it posible to coexist vue2 and vue3? This would be usefull to migrage progressively one application.

If port 8080 is not free before start serve microApp, it occurs error

Error

app-errors.js:9 Uncaught navbar: Application 'navbar' died in status LOADING_SOURCE_CODE: Error loading http://localhost:8080/app.js
    at HTMLScriptElement.<anonymous> (https://cdnjs.cloudflare.com/ajax/libs/systemjs/6.1.1/system.min.js:4:5825)

Expected

If port 8080 is dominant before start app1, app2, navbar, these port will be automatically use incremental port(that is ok), but shoud not occurs error.

vue 3 and vue-router 4

hi
could you create an example of import map with vue 3 and vue-router 4 please?
thanks

create a new div element with each click

Hi,

When I review the application demo.
each time app1 or app2 is clicked, it creates a new div element.

< div id="app1" >< /div >
< div id="app2" >< /div >
< div id="app1" >< /div >
< div id="app2" >< /div >
....

why do this in 'root-html-file/index.html'

What error did you get?

i hava a similar doubt

when i commented out this code in ‘root-html-file/index.html’

// 'root-html-file/index.html'

Promise.all([System.import('single-spa'), System.import('vue'), System.import('vue-router')]).then(function (modules) {   
    //var singleSpa = modules[0];
    //var Vue = modules[1];
    //var VueRouter = modules[2];
    //Vue.use(VueRouter)

it will be error to use router in 'navbar/src/App.vue'

this.$router.push('/navbar')
// this.$router   is  undefined

image

but it works in vue-microfrontends[https://github.com/vue-microfrontends]

Originally posted by @mango-csl in #37 (comment)

vue-cli3

Sorry to trouble you again. I have two problem.

  1. I use vue-cli3 to make a project, modify according to app1, but error
    image
  2. I have deploy the app1 and app2 in the 3001 server, then click app1, make a error
    image
    Only if I refresh my browser, the picture will appear.

Isolated styles

Hi, I have same style class name like '.app' in app1 and app2.
But there are not Isolated, any ideas?

Vuex can't work??

app-errors.js:9 Uncaught main: Application 'main' died in status LOADING_SOURCE_CODE: t.isBuffer is not a function
    at y (<anonymous>:1:2232)
    at f (<anonymous>:1:3275)
    at Object.<anonymous> (<anonymous>:1:928)
    at Object.r (<anonymous>:1:375)
    at Object.emit (<anonymous>:1:694)
    at devtoolPlugin (http://localhost:8080/app.js:12740:15)
    at new Store (http://localhost:8080/app.js:13042:5)
    at Module../src/store.js (http://localhost:8080/app.js:15034:64)
    at __webpack_require__ (http://localhost:8080/app.js:737:30)
    at fn (http://localhost:8080/app.js:111:20)
import "./set-public-path";
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import singleSpaVue from "single-spa-vue";
import store from "./store";
Vue.config.productionTip = false;

const vueLifecycles = singleSpaVue({
    Vue,
    appOptions: {
        render: h => h(App),
        router,
        store
    }
});

export const bootstrap = vueLifecycles.bootstrap;
export const mount = vueLifecycles.mount;
export const unmount = vueLifecycles.unmount;

how to build and deploy?

could you tell me how to build this project and how to deploy it in production environment ?
thanks a lot , and waiting for you reply.

Upgrade to vue cli 4

We should update this example to vue cli 4. I would love to accept a PR for this.

Standalone Mode

Is there a way to run subapps independently, via some scripts in package.json?

Unexpected token '<'

npm run build
production: use nginx
When the page is refreshed, Error occurred
image

component: () => import( /* webpackChunkName: "about" */ './views/About.vue')

Hello,I built the app3 project with reference to APP2, but in both projects, when I clicked route about, an error occurred.
error

Because when you switch app2 or app3, the URL address of about.js does not change, but when you refresh it, it becomes the correct address.

Accessing a large subapp, I found that the problem caused by lazy routing loading prevented the handover from successfully switching to other apps.
If you don't use routing lazy loading, there's no problem.

Support for IE 11.

Can we expect support for IE11 for coexisting-vue-microfrontend app ?

Application died in status LOADING_SOURCE_CODE: window.Vue.use is not a function

singleSpa.registerApplication(
'proj1',
() => System.import('proj1'),
location => location.hash.startsWith('#/jpro')
// location => true
)

when I use: location => location.hash.startsWith('#/jpro') , I get the error below,but it works fine when I use: location => true; I don't konw why? please help me. thanks a lot

Uncaught proj1: Application 'proj1' died in status LOADING_SOURCE_CODE: window.Vue.use is not a function
at Module../node_modules/vue-router/dist/vue-router.esm.js (http://localhost:8002/app.js:261976:14)
at webpack_require (http://localhost:8002/app.js:778:30)
at fn (http://localhost:8002/app.js:141:20)
at Module../src/router/index.js (http://localhost:8002/app.js:283598:68)
at webpack_require (http://localhost:8002/app.js:778:30)
at fn (http://localhost:8002/app.js:141:20)
at Module../src/main.js (http://localhost:8002/app.js:281169:67)
at webpack_require (http://localhost:8002/app.js:778:30)
at fn (http://localhost:8002/app.js:141:20)
at Object.2 (http://localhost:8002/app.js:284653:18)

Images from the individual applications doesnt appear

Hi,
When the individual app is invoked the logo/images from that module doesnt load it gives error as it takes the parent path for search and loading.

The same is seen in the sample app as well.

Can you please guide on this.

Thanks

Picture not found

I'm now under the navbar project, I'm going to put an image and I'm going to reference it on the page, and then I'm going to run project 5000, and it's going to show me the image's load path is 5000 and I can't find that image. How do you solve this?

How can I import components?

How can I import a component?
I'm trying to do that but always throw this anoying error:

Module not found: Error: Can't resolve '/components/home.vue' in 'D:\estudos\microfrontend\single-spa-app\src\vue'
 @ ./src/vue/main.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/vue/main.vue?vue&type=script&lang=js&) 4:0-40 7:10-14
 @ ./src/vue/main.vue?vue&type=script&lang=js&
 @ ./src/vue/main.vue
 @ ./src/vue/vue.app.js
 @ ./single-spa.config.js

If you could help me this is my repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.