Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!DOCTYPE html>
<html>
<head>
<title>Root application</title>
<meta name="importmap-type" content="systemjs-importmap">
<script type="systemjs-importmap">
{
"imports": {
"angular-app": "http://localhost:4201/main.js",
"react-app": "http://localhost:4202/main.js",
"single-spa": "https://unpkg.com/single-spa@4.3.2/lib/system/single-spa.min.js"
}
}
</script>
<!-- Loading of required libraries shouyld be added -->
</head>
<body>
<header class="header-fixed">
<nav>
<a href="/angular-app">Angular app</a>
<a href="/react-app">React app</a>
</nav>
</header>
<script>
System.import('single-spa').then(function (singleSpa) {
singleSpa.registerApplication(
'angular-app',
() => System.import('angular-app'),
location => location.pathname.startsWith('/angular-app')
);
singleSpa.registerApplication(
'react-app',
() => System.import('react-app'),
location => location.pathname.startsWith('/react-app')
)
singleSpa.start();
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.