如何在 jhipster 项目中使用chart.js

Sau*_*mar 1 jhipster webpack html-webpack-plugin webpack-2 angular

所以我想用以下项目尝试 Chat.js。

https://github.com/mraible/jhipster4-demo
Run Code Online (Sandbox Code Playgroud)

所以我研究并发现了以下内容 http://valor-software.com/ng2-charts/

所以我安装了 ng-2 图表。ng2-charts 需要chart.js,所以我也安装了chart.js,我可以在jhipster4-demo 项目的node_modules 下看到它。

ng2图表说

Embedding Chart.js in application is mandatory!

<script src="node_modules/chart.js/src/chart.js"></script>
Run Code Online (Sandbox Code Playgroud)

如何在 jhipster4-demo 项目中执行上述强制性步骤?由于我不是 webpack 专家,因此不确定如何执行此操作。

Gaë*_*iou 5

将您的库导入src/main/webapp/app/vendor.ts

import 'chart.js/src/chart.js';
Run Code Online (Sandbox Code Playgroud)

这就是同样在 Matt Raible 的演示应用程序中生成的README.md文件的“管理依赖项”部分中的解释