Skip to content

Instantly share code, notes, and snippets.

@zinevych
Created November 24, 2019 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zinevych/3605de7aa03971d659032c7c14be983a to your computer and use it in GitHub Desktop.
Save zinevych/3605de7aa03971d659032c7c14be983a to your computer and use it in GitHub Desktop.
<!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