torusresearch / torus-embed

Embeds the Torus Wallet directly in your application via torus-embed. Exposes a Web3 Provider.
https://demo-eth.tor.us
MIT License
84 stars 52 forks source link

Issue with initializing torus #466

Closed tansonlee closed 2 years ago

tansonlee commented 2 years ago

Describe the bug Importing torus through import Torus from '@toruslabs/torus-embed'; leads to errors saying Module not found: Can't resolve 'http'. This happens for http, https, and os.

When the following into my next.config.js file, it leads to an error saying TypeError: Class extends value undefined is not a constructor or null which i believe is a circular import error.

http: false,
https: false,
os: false,

To Reproduce My nextJS component is the following:

import Torus from '@toruslabs/torus-embed';

export const Home = () => {
  const handleClick = async () => {
    const torus = new Torus({});
  };
  return (
    <Box>
      <Button onClick={handleClick}>click</Button>
    </Box>
  );
};

This leads to the Module not found: Can't resolve 'http' error.