I have a small web app and I have now decided to tidy it up a bit and separate out the functions into a functions.js file.
I'm exporting these and importing these in the main.js file however I'm getting the error "Uncaught SyntaxError: Unexpected token '{'.
I'm defining it in the index.html
<head>
<script type = "module" src="functions.js"></script>
</head>
<body>
<div id="root"></div>
<script type = "module" src="scripts.js"></script>
</body>
functions.js
export function hello() {
return "Hello";
}
export function hello2() {
return "Hello";
}
Main.js
import { hello, hello2 } from 'functions.js';
However when I run this using "Static-Server" I'm getting the error mentioned above. I'm not sure why this is happening as the code look ok?