📝 Update docs

This commit is contained in:
Jakub Juszczak
2017-03-04 15:32:10 +01:00
parent 9238f1c8cd
commit e38e208532
2 changed files with 16 additions and 26 deletions

View File

@@ -177,29 +177,20 @@ export default Line.extend({
}) })
``` ```
## Webpack & Bundling tools ## Webpack, Browserify and dist files.
There are now two version the main entry point is `src/index.js` which is the ES6 source, unbundled.
If you're using webpack it is recommended to use this one. Because the bundled umd version has vue.js and chart.js bundled into it.
However if you have problems o you can import the dist file If you use `import VueCharts from 'vue-chartjs'` you will mostly import the UMD build of vue-chart.js
This is because of compatibility reasons. This approach however has a downside: vue.js and chart.js are bundled into the file.
And you end up with two vue instances.
If you're using webpack 2 however, it will automatically import the transpiled ES sources.
If you know what you're doing you can import directly from the transpiled es sources:
``` ```
import VueCharts from 'vue-chartjs/dist/vue-chartjs' import { Line } from 'vue-chartjs/es'
// or
import { Line } from 'vue-chartjs/dist/vue-chartjs'
``` ```
Or you can set an alias.
### Browserify
In order for a browserify user to transpile the code, they would need to install `babelify` and `babel-preset-es2015` and add a .babelrc file in the root of their project with the following code:
```
{
"presets": ["es2015"]
}
```
## Available Charts ## Available Charts
### Bar Chart ### Bar Chart

View File

@@ -279,20 +279,19 @@ Sometimes you need more control over chart.js. Thats why you can access the char
![Bubble](assets/bubble.png) ![Bubble](assets/bubble.png)
## Webpack & Bundling tools ## Webpack, Browserify and dist files.
There are now two version the main entry point is `src/index.js` which is the ES6 source, unbundled.
If you're using webpack it is recommended to use this one. Because the bundled umd version has vue.js and chart.js bundled into it.
However if you have problems o you can import the dist file If you use `import VueCharts from 'vue-chartjs'` you will mostly import the UMD build of vue-chart.js
This is because of compatibility reasons. This approach however has a downside: vue.js and chart.js are bundled into the file.
And you end up with two vue instances.
If you're using webpack 2 or rollup however, it will automatically import the transpiled ES sources.
If you know what you're doing you can import directly from the transpiled es sources:
``` ```
import VueCharts from 'vue-chartjs/dist/vue-chartjs' import { Line } from 'vue-chartjs/es'
// or
import { Line } from 'vue-chartjs/dist/vue-chartjs'
``` ```
Or you can set an alias.
### Browserify ### Browserify
In order for a browserify user to transpile the code, they would need to install `babelify` and `babel-preset-es2015` and add a .babelrc file in the root of their project with the following code: In order for a browserify user to transpile the code, they would need to install `babelify` and `babel-preset-es2015` and add a .babelrc file in the root of their project with the following code: