Highcharts: Loading multiple versions of highcharts

Created on 31 May 2016  ·  3Comments  ·  Source: highcharts/highcharts

Hi,

I have highcharts3 within my system and I want to start using highcharts4 also.

I shouldn't have any problem since the latest version supports webpack...
But this line throws error 16 (multiple highcharts loaded) and stops the execution.

Expected behaviour

It should let me load highcharts more then once since i'm not overriding the highcharts of the window scope...

Actual behaviour

It throws an error and does not allow me to load highcharts 4

Not a bug

Most helpful comment

I understand why this would work, but Its not possible for me to load Highcharts 4 before Highcharts 3 :disappointed:
I did managed to find a workaround using webpack's string-replace-loader, I added this to my webpack.config file

{test: /highcharts.src.js$/, loader: 'string-replace', query:{
    search:'error(16, true)',
    replace:'{win:win}',
}},

This just ignores the error and does not hurt my original Highcharts file :wink:

Can you think of a better way to handle this?

All 3 comments

Hi @deanshub,

I believe you are loading Highcharts 3 first, and Highcharts 4 last. Then Highcharts 4 will still check if Highcharts already exists on window. If this is the case, try loading Highcharts 4 before Highcharts 3.

I understand why this would work, but Its not possible for me to load Highcharts 4 before Highcharts 3 :disappointed:
I did managed to find a workaround using webpack's string-replace-loader, I added this to my webpack.config file

{test: /highcharts.src.js$/, loader: 'string-replace', query:{
    search:'error(16, true)',
    replace:'{win:win}',
}},

This just ignores the error and does not hurt my original Highcharts file :wink:

Can you think of a better way to handle this?

Sorry, but I can not think of a better solution for your case. :confused:

I will close this issue due to we are not considering this as a bug. Should you or anyone have any further questions on the subject, just reply to this thread.

Was this page helpful?
0 / 5 - 0 ratings