Skip to content

Instantly share code, notes, and snippets.

@newbornfrontender
Created January 11, 2019 14:50
Show Gist options
  • Save newbornfrontender/068086fc9c50473132fc077ec42b1d02 to your computer and use it in GitHub Desktop.
Save newbornfrontender/068086fc9c50473132fc077ec42b1d02 to your computer and use it in GitHub Desktop.
Native importmap (not working)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<link rel="modulepreload" href="log.js"></link>
<link rel="modulepreload" href="import:lodash">
<script type="importmap">
{
"imports": {
"lodash": "/node_modules/lodash-es/lodash.js"
}
}
</script>
</head>
<body>
<button onclick="import('./log.js').then(({ log }) => log('world'))">Click me</button>
<script type="module">
import _ from 'lodash';
</script>
</body>
</html>
export const log = (msg) => console.log(`Hello ${msg}!`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment