【发布时间】:2019-04-30 15:09:41
【问题描述】:
我想在 Angular 项目中使用 d3plus。主要是因为它巧妙的文字换行。
我创建了一个d3.lib.ts 文件:
export * from 'd3';
export * from 'd3plus';
'd3plus' 在 IntelliJ 中是红色的。我已经 npm 安装了 d3、d3plus、@types/d3 和 @types/d3plus。这可能有点矫枉过正,但这里肯定有一些东西应该起作用。
当我构建时,我得到:
ERROR in ./node_modules/d3plus/src/init.coffee 1:0
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
> ###*
| # @class d3plus
| ###
ERROR in ./node_modules/d3plus/src/libs.coffee 1:26
Module parse failed: Unexpected token (1:26)
You may need an appropriate loader to handle this file type.
> window.d3 = require "d3"
| window.topojson = require "topojson"
似乎 Angular 正在尝试解释 coffeescript,但我不知道它为什么会这样做。为什么不简单地忽略它并使用它上面文件夹中的 d3plus.js?
我该如何让它发挥作用?这是正确的方法吗?
【问题讨论】: