Skip to content

Instantly share code, notes, and snippets.

@tommie
Created July 25, 2022 14:36
Show Gist options
  • Save tommie/f20e4c297cf86044681abd04df3d6ce5 to your computer and use it in GitHub Desktop.
Save tommie/f20e4c297cf86044681abd04df3d6ce5 to your computer and use it in GitHub Desktop.
export const A = 42;
import * as x from './a.esm.js';
console.log('x.A is', x.A); // BAD: "x.A is undefined"
<!DOCTYPE html>
<html>
<script async src="es-module-shims.js"></script>
<script type="importmap">{"imports": {"a": "./a.esm.js"}}</script>
<script type="module">
import {A} from 'a';
console.log('A is', A); // GOOD: A is 42
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment