question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Routing Problem between main-App and sup-App

See original GitHub issue

Hello!

I have a main-application (localhost:3000@App.js) (running with react):

import './App.css';
import { registerMicroApps, setDefaultMountApp, start } from 'qiankun';
import { addGlobalUncaughtErrorHandler } from 'qiankun';
import Header from './components/Header'

addGlobalUncaughtErrorHandler((event) => console.log(event));
function App(props) {

  registerMicroApps([
    {
      name: 'react app', // app name registered
      entry: '//localhost:3001',
      container: '#react-app',
      activeRule: '/react-app',
    },
    {
      name: 'vue app',
      entry: { scripts: ['//localhost:7100/main.js'] },
      container: '#yourContainer2',
      activeRule: '/yourActiveRule2',
    },
  ]);
  setDefaultMountApp('/react-app')
  start();


  return (
    <div className="App">
      <Header></Header>
    </div>
  );


}

export default App;

And i have a subApplication (localhost:3001@App.js) (running with react)

import React from 'react'
import { BrowserRouter } from 'react-router-dom'
import './App.css';

function App() {
  return (
    <div className="App">
      <BrowserRouter basename={window.__POWERED_BY_QIANKUN__ ? '/react-app' : '/'}>
      <h2>Sub-App</h2>
      </BrowserRouter>

    </div>
  );
}

export default App;

In the main application i render a component called <Header> which holds the logic for the navigation:

import React from "react";
import Styles from "./Header.module.css";
import Logo from "../assets/avocodo-white.png";
import { BrowserRouter, Link } from "react-router-dom";

const Header = (props) => {
//   const [activeLink, setActiveLink] = useState("");

//   const linkClickHandler = (event) => {
//     event.preventDefault();
//     const links = ["react-app"];

//     if (event.target.innerHTML.indexOf(links) !== -1) {
//       setActiveLink(event.target.innerHTML.indexOf(links));
//     }
//   };

  return (
    <div className={Styles.Header}>
      <img alt="Avocodo Logo" src={Logo}></img>
      <h1>Main Application</h1>
      <BrowserRouter basename={window.__POWERED_BY_QIANKUN__ ? '/react-app' : '/'}>
        <Link to="/react-app">React-App</Link>
      </BrowserRouter>
    </div>
  );
};

export default Header;

I’m trying to make a SPA where the navigation@Header.js routes to the corresponding micro-application.

When i run the application as it is now i get:

Error: application ‘react app’ died in status LOADING_SOURCE_CODE: [qiankun]: Target container with #react-app not existed while react app loading!

I’ve gone through the FAQ-section of the qiankun-project, but can’t wrap my head around on how i can resolve this issue properly.

Can anyone help me out and tell me what needs to be done to resolve that?

Thank you in advance!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mgrub1commented, Sep 14, 2021

Update:

The routing seems to work better now, as the first link of the two is being opened when clicked on. But, if you change from Link1 to Link2 to route to the second micro-app, the application breaks with:

Uncaught Error: application ‘react app’ died in status LOADING_SOURCE_CODE: [qiankun]: Target container with #react-app not existed while react app loading!

0reactions
github-actions[bot]commented, Nov 14, 2021

Since the issue was labeled with Need Reproduction, but no response in 30 days. This issue will be close. If you have any questions, you can comment and reply. 由于该 issue 被标记为需要可复现步骤,却 30 天未收到回应。现关闭 issue,若有任何问题,可评论回复。

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug List - Bugs - Eclipse
ID Product Comp Assignee△ Status△ Changed 486198 4DIAC 4DIAC‑ID 4diac‑inbox UNCO 2016‑01‑20 491690 4DIAC 4DIAC‑ID 4diac‑inbox UNCO 2016‑04‑14 512145 4DIAC 4DIAC‑ID 4diac‑inbox UNCO 2017‑02‑13
Read more >
Mobile 3D Graphics - Eurographics Digital Library
Another problem is due to the small physical size. ... should be pocketable (assuming you don't want to take the route of growing...
Read more >
micro-frontends issues and how to fix | GitAnswer
qiankun routing Problem between main-App and sup-App ... qiankun :sparkles: communication development kits between master and sub apps ...
Read more >
Dash canvas roadmap - Plotly/Dash.Jl - IssueHint
Are there features of canvas you can't replicate this way? ... Routing Problem between main-App and sup-App, 5, 2021-09-09, 2022-09-27.
Read more >
Generation of the CSS/SCSS files - Hashicorp/Flight - IssueHint
@johncowen as discussed yesterday with you and @amyrlam, I have committed a ... Routing Problem between main-App and sup-App, 5, 2021-09-09, 2022-08-13.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found