首页 > 解决方案 > Angular 在咖啡上使用 d3plus 扼流圈

问题描述

我想在 Angular 项目中使用 d3plus。主要是因为它巧妙的文字换行。

我制作了一个d3.lib.ts文件:

export * from 'd3';
export * from 'd3plus';

IntelliJ 中的“d3plus”为红色。我已经 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 似乎正在尝试解释咖啡脚本,但我不知道它为什么会这样做。为什么不简单地忽略它并使用其上方文件夹中的 d3plus.js?

我如何让这个工作?这是正确的方法吗?

标签: angulard3.jsd3plus

解决方案


尝试 npm i d3plus@next ,它将安装剩余的软件包。


推荐阅读