<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="module" src="./script.js"></script>
</body>
</html>
(async () => {
const {default: MyClass} = await import("./MyClass.js");
let c = new MyClass();
// ...
})()
.catch(error => {
// Handle/report error
console.error(error);
});
export default class MyClass {
constructor() {
const p = document.createElement("p");
p.appendChild(document.createTextNode("MyClass okay!"));
document.body.appendChild(p);
}
}