solana-auth
solana-auth copied to clipboard
Package doesn't work with Next.js because of invalid ESM
As far as I understand, ESM (at least in Next.js) doesn't support the "importing a folder implicitly means importing its index.js" feature. I get this error, when running the example project given in this very repo:
error - unhandledRejection: Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/private/tmp/crossmint-solana-auth/node_modules/@crossmint/solana-auth-base/lib/esm/handlers' is not supported resolving ES modules imported from /private/tmp/crossmint-solana-auth/node_modules/@crossmint/solana-auth-base/lib/esm/index.js
I can temporarily resolve this by deleting the esm
folder from the node_modules for this package, forcing Next to use the cjs
folder instead, but there is no good way to reproduce that programmatically.
I ended up temporarily hacking around this by doing import {...} from '../../../../node_modules/@crossmint/solana-auth-base/lib/cjs'
Hi @phoenixeliot! We are working on fixing this.
For now, we suggest using the next-transpile-modules
package as explained here in the README.
I get this same error, even with next-transpile-modules