Solc Error in browser

Hi,
i am trying to compile smart contract in react app with solc but it gives me this error:

Code is copied from their github documentation:

const compileContract = async() => {
        var solc = require('solc');        
        var input = {
          language: 'Solidity',
          sources: {
            'test.sol': {
              content: 'contract C { function f() public { } }'
            }
          }
        };
        
        var output = JSON.parse(solc.compile(JSON.stringify(input)));
        
        // `output` here contains the JSON output as specified in the documentation
        for (var contractName in output.contracts['test.sol']) {
          console.log(
            contractName +
              ': ' +
              output.contracts['test.sol'][contractName].evm.bytecode.object
          );
        }
    }

did you try to search that error on google?

Yes but I dont get it what is wrong…none of my code uses wasm, maybe solc library does. There has already been this issue but it has not been solved: https://github.com/ethereum/solc-js/issues/456

I was looking into and found this -

It is the same error I guess which you are facing @2Tijan7N

Also, I didn’t knew about web workers until now, but a quick google search led me to this - https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers

1 Like

Thanks @gat786 :raised_hands:

1 Like