node
node copied to clipboard
TypeError: IPinfoWrapper is not a constructor when building a SvelteKit app
My SvelteKit app works fine in dev mode.
However when i attempt to build, i get TypeError: IPinfoWrapper is not a constructor. My code looks like this:
import IPinfoWrapper from 'node-ipinfo';
import { IPINFO_TOKEN } from "$env/static/private";
const ipinfoWrapper = new IPinfoWrapper(IPINFO_TOKEN);
const IPinfos = await ipinfoWrapper.lookupIp(requestIP);
The full version in my wip is here if that helps: https://github.com/gtnbssn/lEmplacementExactDuCoeur/blob/main/src/routes/api/connect/%2Bserver.ts
I have found a very similar previous issue here: https://github.com/ipinfo/node/issues/44
It doesn't help though.
Is there a typescript setting I need to change maybe?
It works if I import like this:
import { IPinfoWrapper } from 'node-ipinfo';