Last active
July 23, 2019 19:52
-
-
Save crazy4groovy/9ce05a572aed8b68ce77c2a080615905 to your computer and use it in GitHub Desktop.
Example SystemJS usage
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
{ | |
"imports": { | |
"lodash": "https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js" | |
} | |
} |
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
import _get from "lodash/get"; | |
const name = _get({name: 'Steve'}, '.name') | |
console.log({name}) | |
document.querySelector('#name').innerText = name |
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
<div id="name">What is my name??</div> | |
<script> | |
if (typeof Promise === 'undefined') | |
document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.5.5/bluebird.core.min.js"><\/script>') | |
if (typeof fetch === 'undefined') | |
document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/3.0.0/fetch.min.js"><\/script>') | |
</script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/4.1.0/system.min.js" | |
integrity="sha256-i+j3ZmMaI9nPuzasKbNrT3evNnUewPBf5p9UEJdr2zA=" | |
crossorigin="anonymous"> | |
</script> | |
<script type="systemjs-importmap" src="./imports.json"></script> | |
<script> | |
System.import('./main.js') | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment