Skip to content

Commit

Permalink
Use ES5 for Chart.bundle.js - fixes #563
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Apr 6, 2021
1 parent e8ed5a3 commit f52d5c5
Show file tree
Hide file tree
Showing 7 changed files with 23,767 additions and 18,802 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.bundle
.config
.yardoc
Gemfile.lock
*.lock
InstalledFiles
_yardoc
coverage
Expand All @@ -15,3 +15,4 @@ spec/reports
test/tmp
test/version_tmp
tmp
node_modules
4 changes: 4 additions & 0 deletions build/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Chart from "chart.js/auto"
import "chartjs-adapter-date-fns"

export default Chart
20 changes: 20 additions & 0 deletions build/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "build",
"private": true,
"scripts": {
"build": "rollup -c"
},
"devDependencies": {
"@babel/cli": "^7.13.14",
"@babel/core": "^7.13.14",
"@babel/preset-env": "^7.13.12",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"rollup": "^2.44.0"
},
"dependencies": {
"chart.js": "3.0.2",
"chartjs-adapter-date-fns": "2.0.0",
"date-fns": "2.19.0"
}
}
43 changes: 43 additions & 0 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import babel from "@rollup/plugin-babel";
import resolve from "@rollup/plugin-node-resolve";

// use same banner as projects
// 1. https://unpkg.com/[email protected]
// 2. https://unpkg.com/[email protected]
// 3. https://unpkg.com/[email protected] (no banner)
const banner = `/*!
* Chart.js v3.0.2
* https://www.chartjs.org
* (c) 2021 Chart.js Contributors
* Released under the MIT License
*
* chartjs-adapter-date-fns v2.0.0
* https://www.chartjs.org
* (c) 2021 chartjs-adapter-date-fns Contributors
* Released under the MIT license
*
* date-fns v2.0.19
* https://date-fns.org
* (c) 2020 Sasha Koss and Lesha Koss
* Released under the MIT License
*/
`;

export default [
{
input: "index.js",
output: {
name: "Chart",
file: "../vendor/assets/javascripts/Chart.bundle.js",
format: "umd",
banner: banner
},
plugins: [
resolve(),
babel({
babelHelpers: 'bundled',
presets: [['@babel/preset-env', {targets: 'defaults'}]]
})
]
}
];
Loading

0 comments on commit f52d5c5

Please sign in to comment.