Chris Stryczynski
Chris Stryczynski

Reputation: 33891

How to include highcharts exporting module when using webpack?

Instead of <script src="http://code.highcharts.com/modules/exporting.js"></script>

How can I add it as a dependency when using webpack? Is it available under some module?

Upvotes: 1

Views: 801

Answers (1)

ppotaczek
ppotaczek

Reputation: 39099

You need to import and initialize the module:

import Highcharts from 'highcharts';
import exporting from 'highcharts/modules/exporting';

exporting(Highcharts);

or use require:

import Highcharts from 'highcharts'
require("highcharts/modules/exporting")(Highcharts);

Live demo: https://stackblitz.com/edit/react-tepuf4?file=index.js

Docs: https://www.highcharts.com/docs/getting-started/install-from-npm

Upvotes: 3

Related Questions