wallet-adapter: Can't import the named export 'Button' from non EcmaScript module (only default export is available)
Describe the bug I’m seeing the following issue now from the latest version likely due to .mjs version .
./node_modules/@solana/wallet-adapter-material-ui/lib/esm/WalletConnectButton.mjs
Can't import the named export 'Button' from non EcmaScript module (only default export is available)
To Reproduce
Use @solana/wallet-adapter-material-ui@0.16.3
.
Expected behavior Expected it to run successfully.
Additional context I’m guessing this is due to a restriction of .mjs files need to import from EcmaScript modules / esm files, but material-ui exports plain .js files despite them using es import styles.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 35
Commits related to this issue
- have vite output .mjs file — committed to anza-xyz/wallet-adapter by jordaaash 2 years ago
Thanks for your patience everyone. I was able to repro this with Create React App version 4.
Using that as the preamble, importing anything from
@solana/wallet-adapter-wallets
failed as you all have described.Here’s what I think is going on:
For folks using Create React App v4: the build system simply doesn’t support Ecmascript modules. In order to reconfigure CRA4 to recognize .mjs files, I tried this, which worked:
Then open
config-overrides.js
and add the following:For folks using Create React App v5: follow along in https://github.com/solana-labs/wallet-adapter/issues/241
Try that, and let me know if it worked!
Having same issue:
Using :
It works for me. Thank you.
I was able to replicate the issue although its complaining about BitKeepWalletAdapter.
latest.zip
@steveluscher Oh, thank you so much. I did it. Last time I was at commit 79ca99a5f6228be8324b211b9361d9da07a02517 so I failed.
Oh, interesting, @zrus. I see
craco
in your terminal output there, which leads me to believe that you’re sitting on an older commit.craco
has been removed since.On a fresh checkout of this repo (at 16fb5cc395e9974a91297549feaf7694191c7093) I have success building from source:
The starter example and material-ui-starter projects both work. I’m guessing the issue is a build tool being used. Can you post a link to a reproduction repo?
it works for me! thanks a lot!!!
I tried the second line command and I got this issue, can you please help me out @steveluscher