Reputation:
export function startingPage () {...rest of function}
import { startingPage } from "./starting-page";
startingPage();
<script src="/dist/main.js" type="text/javascript"></script>
Uncaught SyntaxError: Cannot use import statement outside a module main.js:1
I suppose it does not work because in JS files it should be module.exports = startingPage; as it is in my previous vanilla JS projects and it works just fine, however it is TS project and I have no idea how to make it work. edit: obviosuly, I am then importing it as const startingPage = requrie('...')
Upvotes: 0
Views: 536
Reputation:
Solution to my problem was installing a Parcel - application bundler.
As I mentioned I used it in my vanilla JS projects, so I tried it also now, and it is working just fine. It was more of a JS syntax error than TS project build problem.
Upvotes: 2