hey guys, so i am trying to get a better feel for using modules because i am working on a Tetris game as practice, and it’d be a lot easier if i could separate my functions using different module files. i put together this simple function that i am trying to import to my blank website. it is my understanding that google chrome now supports ES6 modules so i cant figure out why this isn’t working…
This is my HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>module</title>
<script type= "module" src="main.js"></script>
</head>
<body>
</body>
</html>
JS (main.js)
import {myFunc} from "./page1";
window.onload = myFunc;
JS (page1.js)
export function myFunc() {
console.log(7)
};