【发布时间】:2022-01-02 03:50:24
【问题描述】:
我正在尝试将@project-serum/anchor 导入到 Vue 3 项目中,使用
import * as anchor from '@project-serum/anchor';
项目编译正常,但是当组件加载时会抛出错误:
VM28957:1 Uncaught (in promise) ReferenceError: require is not defined
at eval (eval at nodeWrap (sha256.js?6c27:1), <anonymous>:1:1)
at nodeWrap (sha256.js?6c27:83)
at createMethod (sha256.js?6c27:67)
at eval (sha256.js?6c27:501)
at Object.eval (sha256.js?6c27:518)
at eval (sha256.js:521)
at Object../node_modules/js-sha256/src/sha256.js (3.js:1335)
at __webpack_require__ (app.js:854)
at fn (app.js:151)
at Module.eval (common.js?789d:1)
【问题讨论】: