starting-page.ts
export function startingPage () {...rest of function}
main.ts
import { startingPage } from "./starting-page";
startingPage();
index.html
<script src="/dist/main.js" type="text/javascript"></script>
Error:
Uncaught SyntaxError: Cannot use import statement outside a module main.js:1
Description
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('...')
type="module"added to your<script>tag