You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-17Lines changed: 8 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,17 +42,14 @@ bower install highcharts
42
42
```
43
43
44
44
## Load Highcharts as a CommonJS module
45
-
Highcharts is using an UMD module pattern, as a result it has support for CommonJS.
45
+
Highcharts uses a UMD (Universal Module Definition) module pattern, which provides support for CommonJS. However, starting from version 12, the module system has been simplified.
46
46
*The following examples presumes you are using npm to install Highcharts, see [Download and install Highcharts](#download-and-install-highcharts) for more details.*
47
47
```js
48
48
// Load Highcharts
49
-
var Highcharts =require('highcharts');
50
-
// Alternatively, this is how to load Highcharts Stock. The Maps and Gantt
51
-
// packages are similar.
52
-
// var Highcharts = require('highcharts/highstock');
// Load the exporting module (no need to initialize explicitly from v12)
52
+
require('highcharts/modules/exporting');
56
53
57
54
// Generate the chart
58
55
Highcharts.chart('container', {
@@ -61,7 +58,7 @@ Highcharts.chart('container', {
61
58
```
62
59
63
60
## Load Highcharts as an ES6 module
64
-
Since Highcharts supports CommonJS, it can be loaded as an ES6 module with the use of transpilers. Two common transpilers are [Babel](https://babeljs.io/) and [TypeScript](https://www.typescriptlang.org/). These have different interpretations of a CommonJS module, which affects your syntax.
61
+
Since Highcharts supports CommonJS, it can be loaded as an ES6 module with the use of transpilers. Two common transpilers are [Babel](https://babeljs.io/) and [TypeScript](https://www.typescriptlang.org/). These have different interpretations of a CommonJS module, which affects your syntax. With Highcharts v12, ES6 modules are supported out of the box without the need to initialize module factories.
65
62
*The following examples presumes you are using npm to install Highcharts, see [Download and install Highcharts](#download-and-install-highcharts) for more details.*
66
63
### Babel
67
64
```js
@@ -70,10 +67,7 @@ import Highcharts from 'highcharts';
0 commit comments