Typescript version of Bundler Polyfill Issues?

Hi,

I am currently trying to set up my auth using Web3Auth with typescript. Whenever I try to run it, I get the issue:

(0 , superstruct_1.boolean) is not a function TypeError: (0 , superstruct_1.boolean) is not a function at ./node_modules/@metamask/abi-utils/dist/parsers/bool.js
I assumed this is an issue related to the config-overrides.js? For some reason, it cannot resolve the superstruct in the @metamask modules within node modules.

Any help would be very useful!

Thanks

1 Like

Hey, can you please share details about Web3Auth packages you are using with their version? I’ll try to reproduce it locally.

Yep, sure!

image

Let me know if you need any more details. I am also using react-app-rewired. The project is ethereum based and I have followed the initial set up along with the config override due to HTML5 issues.

Thanks

Above is my package.json

@Ayush any updates here. I am also facing same error when upgrading the existing application for web3auth from 6.1.7 to 8.6.2

Hey, I’m not able to reproduce. Can you remove the superstruct, delete node modules, lock file and do npm install again? In case if you need superstruct, please use the latest version.

Hey Ayush. Thanks for trying. I have tired to remove the node files and rebuild with npm i. It has not worked for me. Would it be possible for you to make the repo you tried on, public? I assume it’s just a baseplate project tyou tried on?

This way I will be able to find any possible difference.

Thanks

Hey @adityasoh I tried on our PnP examples itself. I’ll try again tomorrow on a new project and see if it’s reproducible.

Hey @adityasoh can you please update the Web3Auth SDKs? There are new updates available for the SDKs.

facing the same issue

This is solved in 8.11.0

After running npm run build or yarn build it’s giving same error. Not fixed yet! Tried multiple times, by even removing node_modules, yarn.lock and build etc folders. But same above error.

Can you check with the latest version 8.12.0?

Hi,
Getting the same problem here:

With version:

"@web3auth/base": "^8.12.0",
    "@web3auth/ethereum-provider": "^8.12.0",
    "@web3auth/metamask-adapter": "^8.12.0",
    "@web3auth/modal": "^8.12.0",
    "@web3auth/openlogin-adapter": "^8.12.0",
    "@web3auth/torus-evm-adapter": "^8.12.0",

And create-react-app with custom-cra config:

// config-overrides.js
const webpack = require('webpack');
const { addExternalBabelPlugin, override }  = require('customize-cra');

module.exports = override(
    addExternalBabelPlugin("@babel/plugin-transform-private-property-in-object"),
    addExternalBabelPlugin("@babel/plugin-transform-private-methods"),
    addExternalBabelPlugin("@babel/plugin-transform-classes"),
    addExternalBabelPlugin("@babel/plugin-proposal-class-properties"),
    (config) => {
        config.resolve.fallback = {
            ...config.resolve.fallback,
            url: require.resolve("url"),
            crypto: require.resolve("crypto-browserify"),
            http: require.resolve("stream-http"),
            https: require.resolve("https-browserify"),
            zlib: require.resolve("browserify-zlib"),
            stream: require.resolve("stream-browserify"),
            vm: require.resolve("vm-browserify"),
            process: require.resolve("process/browser"),
            buffer: require.resolve("buffer")
        }
        config.resolve.extensions = [...config.resolve.extensions, ".ts", ".js"];
        config.plugins.push(
            new webpack.ProvidePlugin({
                process: "process/browser",
                Buffer: ['buffer', 'Buffer'],
            })
        );
        return config
    }
)

Thanks !

EDIT: fixed by this message: Support CJS file extensions by joeldenning · Pull Request #12021 · facebook/create-react-app · GitHub

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

This issue can be fixed by pinning @metamask/rpc-errors sdk version to 6.2.1 or Upgrading to web3auth sdk of 8.12.1