简体   繁体   English

react-highcharts:无法设置未定义的属性“ HighchartsAdapter”

[英]react-highcharts: Cannot set property 'HighchartsAdapter' of undefined

Trying to run next example http://kirjs.github.io/react-highcharts 尝试运行下一个示例http://kirjs.github.io/react-highcharts

Stuck with line: 卡在行上:

global.HighchartsAdapter = require('exports?HighchartsAdapter!highcharts-standalone-adapter');

Without it, get error 没有它,得到错误

Uncaught TypeError: Cannot set property 'HighchartsAdapter' of undefined

With it, obviously get 有了它,显然得到

Cannot find module 'exports?HighchartsAdapter!highcharts-standalone-adapter'

So, the real question is how to include HighchartsAdapter. 因此,真正的问题是如何包括HighchartsAdapter。

PS The title of this question is different because it was my original google request. PS此问题的标题不同,因为它是我最初的Google请求。 And I am not alone https://github.com/kirjs/react-highcharts/search?q=Cannot+set+property+%27HighchartsAdapter%27+of+undefined&type=Issues&utf8=%E2%9C%93 我并不孤单https://github.com/kirjs/react-highcharts/search?q=不能+设置+属性+% 27HighchartsAdapter%27 + of + undefined&type =问题&utf8 =%E2%9C%93

The original example should be bundled using webpack. 原始示例应使用webpack捆绑在一起。 Then I suppose it works fine. 然后,我想它工作正常。

If you want to use Browserify, then instead of using: 如果要使用Browserify,则不要使用:

global.HighchartsAdapter = require('exports?HighchartsAdapter!highcharts-standalone-adapter');
var Highcharts = require("highcharts");

use next: 使用下一个:

var Highcharts = require('highcharts-browserify');

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

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