Last active
January 8, 2018 22:10
-
-
Save rchanou/7c9adc9ac95b5adadd70833ab07a32c8 to your computer and use it in GitHub Desktop.
Boilerplate HTML for app that can use ES2015+/NPM modules (useful for quick one-off apps and experimenting)
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
<head> | |
<script type="text/javascript"> var process = { env: { NODE_ENV: 'production' } }; </script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.13.0/polyfill.min.js" integrity="sha256-1xJxekKA6MkBUKinJgsgPe3sTGMsKK6MzTzr+hKxMfI=" crossorigin="anonymous"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.15.0/babel.min.js" integrity="sha256-mxaL+9zRy1U6ZxZsba9703g+UH0v8Tjo/GUhpGpAjSc=" crossorigin="anonymous"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js" integrity="sha256-KJq4gv89+lNKzudhvvq6QJDLlFycaheMHYEf3UnTa2c=" crossorigin="anonymous"></script> | |
<script type='text/babel' data-presets='es2015,stage-0'> | |
'use strict'; | |
(async () => { | |
// example of requesting an npm module import | |
const importIcepickTask = SystemJS.import('https://unpkg.com/icepick'); | |
// wait for import to complete | |
const I = await importIcepickTask; | |
// do your thang! | |
const test = I.freeze([1,2,3]); | |
console.log(I.setIn(test, [1], 'apple')); | |
})(); | |
</script> | |
</head> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The little
var process = { env: { NODE_ENV: 'production' } };
script is specifically needed foricepick
; it won't "build" unless it thinks it's in node. You may have to do similar hacks for other libraries.