I am getting this error SyntaxError: Cannot use import statement outside a module
when trying to import from another javascript file. This is the first time I'm trying something like this. The main file is main.js
and the module file is mod.js
.
main.js:
import * as myModule from "mod";
myModule.func();
mod.js:
export function func(){
console.log("Hello World");
}
How can I fix this? Thanks