Skip to content

Instantly share code, notes, and snippets.

@ff6347
Last active April 29, 2019 06:01
Show Gist options
  • Select an option

  • Save ff6347/782de3cba72c460eb637f898238c2179 to your computer and use it in GitHub Desktop.

Select an option

Save ff6347/782de3cba72c460eb637f898238c2179 to your computer and use it in GitHub Desktop.
ES6 Modules in the Browser. Run it with `npx reload`
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Page Title</title>
<meta name="description" content="something">
<meta name="author" content="me">
</head>
<body>
<script type="module" src="./module.js"></script>
<script type="module" src="./index.js"></script>
</body>
</html>
import {hello} from './module.js'
document.addEventListener('DOMContentLoaded',function() {
console.info(hello('world'));
});
export const hello = (str) => `Hello ${str}!`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment