Skip to content

Instantly share code, notes, and snippets.

@sc0ttwad3
Created October 15, 2017 03:42
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 sc0ttwad3/18cb49083536bf67ee772136cec37d03 to your computer and use it in GitHub Desktop.
Save sc0ttwad3/18cb49083536bf67ee772136cec37d03 to your computer and use it in GitHub Desktop.
Dynamic ES6 module loading fallback
<script type="text/javascript">
var script= document.createElement('script');
script.type= 'text/javascript';
try {
Function('import("")');
script.src= "app.js"
} catch(e) {
script.src= "fallback.js";
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment