简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM