Created
November 24, 2019 12:37
-
-
Save zinevych/3605de7aa03971d659032c7c14be983a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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