FayeOriginal post
Rank 6: Server
Heyo.
Normally I don't run into these issues, but for some reason I cannot find this one out.
There's some really weird things going on.
This is the beginning of my main.ts file:
TypeScript
import { Client, Databases, Account } from "node-appwrite";
import { getUsers, getUserSelf, getUserData, getUserDataSelf,} from "@/utils/user-actions";import { getEvents } from "@/utils/event-actions";
export const client = new Client();export const account = new Account(client);export const databases = new Databases(client);
export { ID } from "node-appwrite";
type Context = { req: any; res: any; log: (msg: any) => void; error: (msg: any) => void;};
export default async ({ req, res, log, error }: Context) => {But I am getting an error for the imports. :crey:
I tried looking in the template: https://github.com/appwrite/templates/blob/main/node-typescript/whatsapp-with-vonage/src/main.ts, however there you import files using .js even though the files are .ts..? Which also does not work. So confused on that.
Summary
Developers are encountering the "Cannot use import statement outside a module" error in their TypeScript file. The issue lies in the import paths. To resolve it, ensure correct module paths are used, i.e., use relative paths or consider setting up a module resolution strategy.