JS + DharmaProtocol-未捕获的SyntaxError:所请求的模块'...'不提供名为'Dharma'的导出

时间:2019-01-02 02:25:24

标签: javascript dependencies ethereum

我正在根据《佛法协议》构建中继器。尝试导入协议时(通过yarn添加@ dharmaprotocol / dharma.js安装),我收到错误消息:

Uncaught SyntaxError: The requested module 
'./node_modules/@dharmaprotocol/dharma.js/dist/lib/src/index.js' does not 
provide an export named 'Dharma'

我尝试将位于“ node_modules/@dharmaprotocol/dharma.js/dist/lib/src/”目录中的index.js文件重命名为index.mjs,希望JS将其识别为模块文件,但发现了没有成功。

mint.js:

import { Dharma } from "@dharmaprotocol/dharma.js";
const provider = window.web3.currentProvider;
provider.enable();
const dharma = new Dharma(provider);

index.js:

"use strict";
/***********
 *  Utils  *
 ***********/
Object.defineProperty(exports, "__esModule", { value: true });
// Allows the user to instantiate the correct version of BigNumber.js 
without
// needing to add version 5.0.0 to their project.
var bignumber_1 = require("../utils/bignumber");
exports.BigNumber = bignumber_1.BigNumber;
var Web3 = require("web3");
exports.Web3 = Web3;
/***********
 *  Types  *
 ***********/
var dharma_1 = require("./types/dharma");
exports.Dharma = dharma_1.Dharma;

0 个答案:

没有答案