I have an ES6 module (mymodule) and HTML page that has JS code that must be executed when a user opens the page. This is my module:
//mymodule.js
class TestClass {
getString() {
return "TestString";
}
}
export {TestClass}
And this is my page:
//page.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Page</title>
<script src="./mymodule.js" type="module"></script>
</head>
<body>
<h1>Hello World!</h1>
<script type="module">
import {TestClass} from "./mymodule";
let test = new TestClass();
console.log("OUTPUT: " + test.getString());
</script>
</body>
</html>
Page.html and mymodule.js are in the same folder, however, when I open page.html in browser I have nothing on console (no error, no output) - I use FF 62.0.3. How to fix it?