Last active
September 1, 2021 20:42
-
-
Save jleedev/00c583fdcedded9d7232efbf7f823de7 to your computer and use it in GitHub Desktop.
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
<!doctype html> | |
<meta charset=utf-8> | |
<script type=🧩 id=lodash> | |
import content from "lodash/content"; | |
const p = document.createElement("p"); | |
p.textContent = content; | |
export default () => p.cloneNode(true); | |
</script> | |
<script type=🧩 id=lodash/content> | |
export default "i guess this is lodash"; | |
</script> | |
<script> | |
(im => { im.type = 'importmap'; im.textContent = JSON.stringify({ imports: | |
Object.fromEntries([...document.querySelectorAll('script[type=🧩]')].map(s => [ | |
s.id, URL.createObjectURL(new Blob([s.textContent], { type: | |
'application/javascript' }))])) }); document.currentScript.after(im); } | |
)(document.createElement('script')); | |
</script> | |
<script type=module> | |
import lodash from "lodash"; | |
document.body.append(lodash()); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment