utils icon indicating copy to clipboard operation
utils copied to clipboard

Attempted import error: 'Struct' is not exported from 'superstruct'.

Open NishantPatil307 opened this issue 1 year ago • 5 comments

Failed to compile.

./node_modules/@metamask/utils/dist/chunk-6C35XQOF.mjs Attempted import error: 'Struct' is not exported from 'superstruct'.

The build process failed in a file named chunk-6C35XQOF.mjs within the @metamask/utils package. The code in this file tries to import something called Struct from the superstruct library. However, superstruct doesn't provide a public export for Struct.

NishantPatil307 avatar Mar 15 '24 06:03 NishantPatil307

Hi @NishantPatil307, what kind of project do you have? Is it Node or TypeScript? Is your project ESM or CommonJS?

mcmire avatar Mar 20 '24 01:03 mcmire

Im having this issue too with esm.

it's a react project that I try to setup with particle.network https://developers.particle.network/recipes/configuring-particle-auth-core

this current package appears to be a dependencies and throws this same error during build process

irzhywau avatar Jul 10 '24 15:07 irzhywau

Hi @irzhywau, which version of this package are you using? We've been making some updates lately to resolve issues we've seen with superstruct. You should have better luck with at least 8.5.0 although 9.0.0 is preferred. Try either of those out and let us know.

mcmire avatar Jul 11 '24 23:07 mcmire

Facing same issue even using 9.0.0 or 9.1.0 image

hasiniainawau avatar Jul 15 '24 18:07 hasiniainawau

I want to give more insight here, it seems not working only in a create-react-app project, it seems working under a vite or next react project. This issue may not addressed to this package, it's more concerned about @metamask/superstruct. Here some related issue https://web3auth.io/community/t/we-are-facing-this-issue-while-running-this-from-the-app-attempted-import-error-struct-is-not-exported-from-metamask-superstruct/8418

hasiniainawau avatar Jul 19 '24 15:07 hasiniainawau

I tried installing and running the app provided in that URL (https://github.com/mailgourav/Web3Auth) and was unable to reproduce this error.

If someone is able to provide me a repo that produces a bug I can look further into this.

In the meantime I am closing, but I will reopen if this is still a problem.

mcmire avatar Nov 27 '24 17:11 mcmire