Skip to content

Instantly share code, notes, and snippets.

@camille-hdl
Last active July 26, 2019 16:15
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 camille-hdl/7259461f19e5fdfcc3f354ed14f312a9 to your computer and use it in GitHub Desktop.
Save camille-hdl/7259461f19e5fdfcc3f354ed14f312a9 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Rollup React example</title>
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no" />
</head>
<body>
<script>
(function() {
if (navigator && navigator.serviceWorker) {
window.addEventListener("load", () => {
navigator.serviceWorker.register("/js/esm/sw.js", { scope: "/" });
});
}
window.esDynamicImport = true;
// this will throw if dynamic import is not supported
import("/js/esm/index.js");
})();
</script>
<!-- No ES6 modules support : fallback to systemJS -->
<script>
if (!window.esDynamicImport) {
if (navigator && navigator.serviceWorker) {
window.addEventListener("load", () => {
navigator.serviceWorker.register("/js/system/sw.js", { scope: "/" });
});
}
const systemJsLoaderTag = document.createElement('script');
systemJsLoaderTag.src = 'https://unpkg.com/systemjs@4.1.0/dist/s.min.js';
systemJsLoaderTag.addEventListener('load', function () {
System.import("/js/system/index.js");
});
document.head.appendChild(systemJsLoaderTag);
}
</script>
<div id="app-container"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment