portalpayments / solana-wallet-names

Resolves wallet names to wallet addresses (and PFPs) across all of Solana. Includes .abc .backpack .bonk .glow .ottr .poor .sol and @ twitter.
https://getportal.app
MIT License
28 stars 8 forks source link

[Bug] Error when trying to use the npm package in next js app #2

Closed Woody4618 closed 1 year ago

Woody4618 commented 1 year ago

Hello when I try to add this package to my app i get the following error:

error - .../app/node_modules/@portal-payments/solana-wallet-names/dist/index.js:1 import { PublicKey } from "@solana/web3.js"; ^^^^^^

SyntaxError: Cannot use import statement outside a module at compileFunction () at Object.compileFunction (node:vm:360:18) at wrapSafe (node:internal/modules/cjs/loader:1119:15) at Module._compile (node:internal/modules/cjs/loader:1155:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10) at Module.load (node:internal/modules/cjs/loader:1069:32) at Function.Module._load (node:internal/modules/cjs/loader:904:12) at Module.require (node:internal/modules/cjs/loader:1093:19) at require (node:internal/modules/cjs/helpers:108:18)

mikemaccana commented 1 year ago

Apparently next.js has a problem with js files that are ESmodules (which is annoying, Svelte doesn't). @tonivlad has a fix for this though (thanks Vlad) and I'll add another comment when this is in a release.