简体   繁体   English

使用webpack时如何包括highcharts导出模块?

[英]How to include highcharts exporting module when using webpack?

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

How can I add it as a dependency when using webpack? 使用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 现场演示: https : //stackblitz.com/edit/react-tepuf4?file=index.js

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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