Skip to content

Commit 2f0ab67

Browse files
authored
Merge pull request #246 from apertureless/feature/dependency_and_build_fix
Feature/dependency and build fix
2 parents 0b50728 + 474b581 commit 2f0ab67

10 files changed

+822
-34868
lines changed

.babelrc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
{
2-
"presets": ["es2015", "stage-2"],
3-
"plugins": ["transform-runtime"],
2+
"presets": [
3+
["@babel/preset-env", {
4+
"modules": false,
5+
"targets": {
6+
"browsers": [
7+
"last 2 versions"
8+
]
9+
}
10+
}],
11+
"@babel/stage-2"
12+
],
413
"comments": false
514
}

README.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,14 @@ Simply run `yarn add vue-chartjs chart.js`
3838
Or if you want to use it directly in the browser add
3939

4040
```html
41-
<script src="https://unpkg.com/vue-chartjs/dist/vue-chartjs.full.min.js"></script>
41+
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script>
42+
<script src="https://unpkg.com/vue-chartjs/dist/vue-chartjs.min.js"></script>
4243
```
4344
to your scripts. See [Codepen](https://codepen.io/apertureless/pen/zEvvWM)
4445

45-
## Explanation of Different Builds
46-
There are three different entry points. It depends on which build setup do you have. The dependencies are bundled or required as a peerDependency.
47-
48-
- Browser
49-
- Browserify / Webpack 1
50-
- Webpack 2
51-
52-
| Build | Chart.js |
53-
|---|---|
54-
| vue-chartjs.full.js | Bundled |
55-
| vue-chartjs.full.min.js | Bundled |
56-
| vue-chartjs.js | peerDependency |
57-
| vue-chartjs.min.js | peerDependency |
58-
| es/index* | peerDependency |
5946

6047
### Browser
61-
You can use `vue-chartjs` directly in the browser without any build setup. Like in this [codepen](https://codepen.io/apertureless/pen/zEvvWM). For this case, please use the `vue-chartjs.full.min.js` which is the minified version. It has Chart.js bundled into it. And bundled to a UMD Module. So you only need that one file.
48+
You can use `vue-chartjs` directly in the browser without any build setup. Like in this [codepen](https://codepen.io/apertureless/pen/zEvvWM). For this case, please use the `vue-chartjs.min.js` which is the minified version. You also need to add the Chart.js CDN script.
6249

6350
You can then simply register your component:
6451

build/webpack.release.full.js

Lines changed: 0 additions & 92 deletions
This file was deleted.

build/webpack.release.full.min.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

build/webpack.release.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ module.exports = {
2626
umdNamedDefine: true
2727
},
2828
externals: {
29-
'chart.js': 'chart.js'
29+
'chart.js': {
30+
root: 'Chart',
31+
commonjs: 'chart.js',
32+
commonjs2: 'chart.js',
33+
amd: 'chart.js'
34+
}
3035
},
3136
resolve: {
3237
extensions: ['.js', '.vue', '.json'],
@@ -71,7 +76,8 @@ module.exports = {
7176
]
7277
},
7378
plugins: [
74-
new webpack.BannerPlugin(banner)
79+
new webpack.BannerPlugin(banner),
80+
new webpack.optimize.ModuleConcatenationPlugin()
7581
]
7682
}
7783

build/webpack.release.min.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config.output.filename = config.output.filename.replace(/\.js$/, '.min.js')
66
delete config.devtool
77

88
config.plugins = [
9+
new webpack.optimize.ModuleConcatenationPlugin(),
910
new webpack.optimize.UglifyJsPlugin({
1011
sourceMap: false,
1112
compress: {

0 commit comments

Comments
 (0)