Fix RequireJS doc to use UMD file instead (#4252)

This commit is contained in:
Simon Brunel 2017-05-13 14:14:02 +02:00 committed by GitHub
parent 3ff5d489c1
commit c4c00b5834

View File

@ -5,30 +5,32 @@ Chart.js can be integrated with plain JavaScript or with different module loader
## ES6 Modules ## ES6 Modules
```javascript ```javascript
import Chart from 'chart.js' import Chart from 'chart.js';
var myChart = new Chart(ctx, {...}) var myChart = new Chart(ctx, {...});
``` ```
## Script Tag ## Script Tag
```html ```html
<script src="path/to/Chartjs/dist/Chart.js"></script> <script src="path/to/chartjs/dist/Chart.js"></script>
<script> <script>
var myChart = new Chart(ctx, {...}) var myChart = new Chart(ctx, {...});
</script> </script>
``` ```
## Common JS ## Common JS
```javascript ```javascript
var Chart = require('chart.js') var Chart = require('chart.js');
var myChart = new Chart(ctx, {...}) var myChart = new Chart(ctx, {...});
``` ```
## Require JS ## Require JS
```javascript ```javascript
require(['path/to/Chartjs/src/chartjs.js'], function(Chart){ require(['path/to/chartjs/dist/Chart.js'], function(Chart){
var myChart = new Chart(ctx, {...}) var myChart = new Chart(ctx, {...});
}) });
``` ```
> **Important:** RequireJS [can **not** load CommonJS module as is](http://www.requirejs.org/docs/commonjs.html#intro), so be sure to require one of the built UMD files instead (i.e. `dist/Chart.js`, `dist/Chart.min.js`, etc.).