Client on node: Uncaught ReferenceError: require is not defined

前端 未结 8 1591
遥遥无期
遥遥无期 2020-11-21 07:20

So, I am writing an application with the node/express + jade combo.

I have client.js, which is loaded on the client. In that file I have code that calls

8条回答
  •  滥情空心
    2020-11-21 08:00

    Replace all require statements to import statements. Example:

    //BEFORE:
    const Web3 = require('web3');
    //AFTER:
    import Web3 from 'web3';
    

    Worked for me.

提交回复
热议问题