我尝试在我的文件中导入d3,当然这很有用,但我也想使用d3-tip,结果很难以正常方式导入,所以我查看了angular2-cli文档并尝试导入angular-cli.json
中的文件全局 "scripts": [
"../node_modules/d3/build/*.js",
"../node_modules/d3-tip"
],
这似乎有用,它实际上渲染正确,但我在控制台输出中得到了一大堆错误
[default] D:\ang\stockdisplayapp\src\app\chart.component.ts:54:29
Identifier 'd3' must be imported from a module
[default] D:\ang\stockdisplayapp\src\app\chart.component.ts:82:22
Identifier 'd3' must be imported from a module
[default] D:\ang\stockdisplayapp\src\app\chart.component.ts:92:9
Identifier 'd3' must be imported from a module
[default] D:\ang\stockdisplayapp\src\app\chart.component.ts:94:23
Identifier 'd3' must be imported from a module
[default] D:\ang\stockdisplayapp\src\app\chart.component.ts:96:21
Identifier 'd3' must be imported from a module
[default] D:\ang\stockdisplayapp\src\app\chart.component.ts:98:23
等
知道如何解决这些错误消息吗?