使用 import Web3 from "./web3/web3.min.js" 导入
start () {
let web3 = null;
//初始化过程
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
} else {
// set the provider you want from Web3.providers
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7456"));
}
let from = web3.eth.accounts[0];
console.log('from====' + from);
}
报错
Uncaught Error: Unable to resolve bare specifier '__unresolved_0' from http://localhost:7456/scripting/x/mods/fs/0/node_modules/web3/lib/index.js (SystemJS Error#8 https://git.io/JvFET#8)
谢谢您我试试

一起学习呀
才入坑 资料少得一批
谢谢,我的问题已经解决了,我用require报错,import Web3 from “web3/dist/web3.min.js”;这样可以,而且不用设置tsconfig就可以用了
学习了,之前2.x用的是 min.js作为插件的方式实现的, 目前还未解决api代码提示的问题,每次都得自己去找api,楼主解决api提示了吗
还是没有提示
该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。




