我有以下和平的代码可以动态加载json文件:
Integer
已编译的代码包含以下错误:
getWeb3Contract: async function (name, web3, path = './../ABI/') {
const contract = require(path + name + ".json");
const network = await web3.eth.net.getId();
return new web3.eth.Contract...
}
如果我将其重命名为const contract = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }());
,则看起来正确:
.js
这是我的webpack配置:
const contract = __webpack_require__(95)(path + name + ".js");