Ionic3 Highcharts-更多导入错误--JsAllow未设置

时间:2018-01-10 08:31:35

标签: javascript angularjs ionic-framework highcharts angular2-highcharts

我尝试导入Highcharts - 更像是这样:

import Highmore from '../../node_modules/highcharts/highcharts-more';

然后我得到以下错误:

Module '../../node_modules/highcharts/highcharts-more' was resolved to 'C:/Users/.../node_modules/highcharts/highcharts-more.js', but '--allowJs' is not set.

所以我进入我的tsconfig.json并将allowJs添加到我的设置中:

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

之后我得到一个新的错误:

Cannot write file 'C:/Users/../node_modules/highcharts/highcharts-more.js' because it would overwrite input file.

我需要更高的图表 - 在我的整个项目中更多,我找不到另一种方法来导入它。请帮忙

1 个答案:

答案 0 :(得分:0)

使用与此文档中显示的语法相同的语法( Typescript 部分):see screenshot

示例是针对导出模块完成的 - highcharts-more 模块应该以类似方式导入。