Trying to implement Magic in NextJS using TypeScript.
Following this example/tutorial, which uses JS not TS: https://github.com/magiclabs/example-nextjs
Problem: when importing Magic like so
import { Magic } from "magic-sdk";
function createMagic() {
if (typeof window === "undefined") return null;
return new Magic(process.env.NEXT_PUBLIC_MAGIC_PUBLISHABLE_KEY!);
}
export const magic = createMagic();
the following error occurs:
SyntaxError: Cannot use import statement outside a module