Skip to content

Instantly share code, notes, and snippets.

@tommie
Created July 25, 2022 17:07
Show Gist options
  • Save tommie/7a76b4591cbad0e7b94c0d2e7f33042a to your computer and use it in GitHub Desktop.
Save tommie/7a76b4591cbad0e7b94c0d2e7f33042a to your computer and use it in GitHub Desktop.
const AA = 42;
import * as x from './a.esm.js';
console.log('x.A is', x.A); // BAD: "x.A is Object { imports: ..., scopes: {} }"
export { AA as A };
<!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