使用 amcharts4 编译 Angular 8 CLI 项目时出现问题

Mir*_*lok 2 amcharts angular amcharts4 angular8

我将使用@amcharts/amcharts4@4.3.5 的应用程序更新为 Angular 8,现在编译时遇到问题。

已将 amcharts 更新至 4.4.10 版。但问题依然存在。

ERROR in ./node_modules/@amcharts/amcharts4/.internal/core/export/Export.js 68:24
Module parse failed: Unexpected token (68:24)
You may need an appropriate loader to handle this file type.
|             switch (_a.label) {
|                 case 0: return [4 /*yield*/, Promise.all([
>                         import(/* webpackChunkName: "pdfmake" */ "pdfmake/build/pdfmake.js"),
|                         import(/* webpackChunkName: "pdfmake" */ "../../pdfmake/vfs_fonts")
|                     ])];
Run Code Online (Sandbox Code Playgroud)

小智 7

这个解决方法为我做了:

npm install --save acorn@6.1.1
npm dedupe
Run Code Online (Sandbox Code Playgroud)

问题出在 NPM 方面,请在此处查看:

https://github.com/amcharts/amcharts4/issues/1002

在 AmCharts 文档中找到了这一点,这使我采用了上述解决方法:

https://www.amcharts.com/docs/v4/getting-started/integrations/using-webpack/