Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package doesn't work with Next.js because of invalid ESM #42

Open
phoenixeliot opened this issue Apr 1, 2022 · 3 comments · May be fixed by #43
Open

Package doesn't work with Next.js because of invalid ESM #42

phoenixeliot opened this issue Apr 1, 2022 · 3 comments · May be fixed by #43

Comments

@phoenixeliot
Copy link

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.

@phoenixeliot
Copy link
Author

I ended up temporarily hacking around this by doing import {...} from '../../../../node_modules/@crossmint/solana-auth-base/lib/cjs'

@jiito
Copy link

jiito commented Apr 6, 2022

Hi @phoenixeliot! We are working on fixing this.

For now, we suggest using the next-transpile-modules package as explained here in the README.

@Steenos
Copy link

Steenos commented Jul 8, 2022

I get this same error, even with next-transpile-modules

@jiito jiito linked a pull request Jul 21, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants