Last active
July 26, 2019 16:15
-
-
Save camille-hdl/7259461f19e5fdfcc3f354ed14f312a9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
<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/[email protected]/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