0

I try to import Highcharts-more like this:

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

then im getting the following Error:

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

So I go into my tsconfig.json and add allowJs to my settings:

{
  "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
  }
}

After that Im getting a new Error:

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

I need highcharts-more in my whole Project and I couldnt find another way to import it. Please help

  • Why `highcharts-more` instead of standard `highcharts`? – Tomislav Stankovic Jan 10 '18 at 17:01
  • I imported both. The Problem is somehow highcharts module doesnt provide me highcharts-more.js. So I import it directly. The weird thing is that after a random amount of builds (without the allowJS flag) it works. But the Error is really anoying and noone want to build his own app sertain amount of times before you can start to work. –  Jan 11 '18 at 06:01
  • See this https://stackoverflow.com/questions/47116730/how-to-import-highcharts-more – Tomislav Stankovic Jan 11 '18 at 14:22
  • Have you tried to use the same syntax as it's shown in this doc (Typescript section)?: https://www.npmjs.com/package/highcharts (the example is done for the *exporting* module - *highcharts-more* module should be imported analogically) – Kamil Kulig Jan 16 '18 at 12:25
  • this is the right answer @KamilKulig –  Jan 16 '18 at 12:54

1 Answers1

0

Use the same syntax as it's shown in this doc (Typescript section): https://www.npmjs.com/package/highcharts

The example is done for the exporting module - highcharts-more module should be imported analogically.

Kamil Kulig
  • 5,756
  • 1
  • 8
  • 12
  • Works for me. My Problem was with my code I only imported Highcharts but not highcharts-more. –  Jan 16 '18 at 14:34