I wrote a Javascript module called module.js that does the following
export default function myModule() {
return new Promise((resolve) => {
// do a bunch of stuff
});
};
I have the following Javascript code, test.js, that uses myModule() in module.js
import {myModule} from "module";
myModule().then((retVal) => {
console.log(retVal);
});
Unfortunately, my browser console is telling me I have the following syntax error:
Uncaught SyntaxError: Unexpected identifier
The console says the syntax error on line 1 of test.js but I can't see what's wrong with it. Any insight is much appreciated.