Skip to content

Instantly share code, notes, and snippets.

@jleedev
Last active September 1, 2021 20: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 jleedev/00c583fdcedded9d7232efbf7f823de7 to your computer and use it in GitHub Desktop.
Save jleedev/00c583fdcedded9d7232efbf7f823de7 to your computer and use it in GitHub Desktop.
<!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