117
rated 0 times
[
122]
[
5]
/ answers: 1 / hits: 189203
/ 4 Years ago, sat, june 20, 2020, 12:00:00
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
More From » node.js