solana-labs / solana-program-library

A collection of Solana programs maintained by Solana Labs
https://solanalabs.com
Apache License 2.0
3.5k stars 2.04k forks source link

Can't import the named export 'bool' from non EcmaScript module (only default export is available) - spl-token@0.2.0 #3014

Closed Beardev118 closed 2 years ago

Beardev118 commented 2 years ago

I can't use the spl-token 0.2.0 version I have got this error image

dtand commented 2 years ago

Same issue as of today - also running on 0.2.0

Screen Shot 2022-03-21 at 4 01 36 PM

jordaaash commented 2 years ago

Hmm this looks like it may be an issue with your build tool/config/environment. It's caused by something not handling ES module imports correctly.

In general for error reports like this to be useful, there needs to be more complete context about your projects. Please provide a link to a repo that reproduces the issue, since that will help determine the cause.

dtand commented 2 years ago

I think this issue is already resolved here:

https://github.com/solana-labs/wallet-adapter/issues/265

Looks to be related to react create apps v4. The solution mentioned by steveluscher worked for me.

jordaaash commented 2 years ago

Ah, yeah. CRA 4 is generally not good at handling native ESM. There's a CRA5-based starter project that may be of some help. It uses react-app-rewired configuration for handling ESM and libraries without polyfills.

Beardev118 commented 2 years ago

This is related with CRA5.0 and craco 5.0.0. I have solved this issue by updating the craco version.