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

Next.js 12: Cannot find module useWalletModal #246

Closed
stanleycyang opened this issue Jan 6, 2022 · 9 comments · Fixed by #254
Closed

Next.js 12: Cannot find module useWalletModal #246

stanleycyang opened this issue Jan 6, 2022 · 9 comments · Fixed by #254

Comments

@stanleycyang
Copy link

Describe the bug
When deploying to production, I'm seeing this error happen:
Screen Shot 2022-01-05 at 9 58 15 PM

To Reproduce
Steps to reproduce the behavior:

  1. Install the @solana/wallet-adapter-react-ui package in next.js
  2. Set up the wallet connection
  3. Use the WalletMultiButton
  4. Refresh the page, and see the error. You can also see the error in deployment

Expected behavior
The useWalletModal should be provided

Desktop (please complete the following information):

  • OS: Mac OS
  • Browser Chrome
  • Version 96
@jordaaash
Copy link
Collaborator

Please check out the Next-based nextjs-starter project in the repo. There's also the example project that uses Next. The issue is very likely with your project configuration.

https://github.com/solana-labs/wallet-adapter#build-from-source

The steps here should help, just replace the last step with building the nextjs-starter project.

@stanleycyang
Copy link
Author

@jordansexton it looks like this example is broken on nextjs version 12.

@jordaaash jordaaash changed the title Cannot find module useWalletModal Next.js 12: Cannot find module useWalletModal Jan 6, 2022
@jordaaash jordaaash reopened this Jan 6, 2022
@jordaaash
Copy link
Collaborator

Thanks @stanleycyang! Would you be interested in opening a branch + PR to update the nextjs-starter and example starter projects to use Next 12?

@gpoole
Copy link

gpoole commented Jan 7, 2022

Also having the same issue with a fresh project created with create-next-app 12.0.7 and using the sample code from this repo. From what I saw seemed to be caused by the .js extensions used in the esm versions. I tried changing one of the imports that was erroring from .js to .mjs and it was happy with that (just got another error about a different file so can't say 100% it fixes everything).

@jordaaash
Copy link
Collaborator

@gpoole any chance you'd be willing to PR a change to cause the ESM builds to output mjs files and see if it fixes it?

@jordaaash
Copy link
Collaborator

For anyone that needs a temporary workaround, please use the Next.js 11-based starter project.

@gpoole
Copy link

gpoole commented Jan 7, 2022

I had a look at doing a PR for this @jordansexton, but it seems like the fix might be more general. I'd say that this issue is a specific instance of #241, but they're basically caused by the ESM strict resolution problem from what I can see.

@jordaaash
Copy link
Collaborator

#254 will fix this when merged.

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