构建错误,非法重新分配以导入“ d3”

时间:2018-07-17 17:05:53

标签: javascript angular d3.js build compiler-errors

我不能在d3 v4中使用d3-tip。 我在cli上使用angular 5。

我导入模块:

import * as d3 from 'd3';
import d3Tip from 'd3-tip';
d3.tip = d3Tip;

我拥有的版本:

"d3": "5.4.0",
"d3-tip":"0.9.1",

并创建工具提示:

const tip = d3.tip()
.attr('class', 'd3-tip')
.offset([-10, 0])
.html(function(d) {
  return "<strong>Frequency:</strong> <span style='color:red'>" + '69.69' + "</span>";
});
this.svg.call(tip);

这很好用,但是如果我想 npm运行构建 ..,出现一个错误:

Rendering Templates
Compiling TypeScript sources through ngc
Bundling to FESM15

BUILD ERROR
Illegal reassignment to import 'd3'
Error: Illegal reassignment to import 'd3'

有人可以告诉我如何使用d3-tip?我需要退出npm run build .. 谢谢!

0 个答案:

没有答案