homepage.ts
export function homepage () {...rest of function}
app.ts
import { homepage } from "./homepage";
homepage();
index.html
<script src="/dist/app.js" type="text/javascript"></script>
Error:
Uncaught SyntaxError: Cannot use import statement outside a module main.js:1
Description
It seems that the issue lies in the difference between importing statements for vanilla JS and TypeScript projects. In previous vanilla JS projects, I used module.exports = homepage;, which worked fine. However, in this TypeScript project, I am unsure how to properly configure it. edit: Clearly, I need to import it like this: const homepage = requrie('...')