2020-02-14 18:29:33 +01:00
|
|
|
/* eslint-disable import/no-commonjs */
|
2018-12-14 20:20:43 +01:00
|
|
|
/* eslint-env es6 */
|
|
|
|
|
2019-10-27 21:28:30 +01:00
|
|
|
const babel = require('rollup-plugin-babel');
|
2020-02-14 20:11:24 +01:00
|
|
|
const cleanup = require('rollup-plugin-cleanup');
|
2020-04-14 01:33:15 +02:00
|
|
|
const polyfill = require('rollup-plugin-polyfill');
|
2020-02-20 15:41:47 +01:00
|
|
|
const json = require('@rollup/plugin-json');
|
2020-02-21 00:19:59 +01:00
|
|
|
const resolve = require('@rollup/plugin-node-resolve');
|
|
|
|
const terser = require('rollup-plugin-terser').terser;
|
2018-12-14 20:20:43 +01:00
|
|
|
const pkg = require('./package.json');
|
|
|
|
|
2019-03-03 15:19:11 +01:00
|
|
|
const input = 'src/index.js';
|
2020-02-14 18:29:33 +01:00
|
|
|
|
2018-12-14 20:20:43 +01:00
|
|
|
const banner = `/*!
|
|
|
|
* Chart.js v${pkg.version}
|
|
|
|
* ${pkg.homepage}
|
2019-12-07 16:41:56 +01:00
|
|
|
* (c) ${(new Date(process.env.SOURCE_DATE_EPOCH ? (process.env.SOURCE_DATE_EPOCH * 1000) : new Date().getTime())).getFullYear()} Chart.js Contributors
|
2018-12-14 20:20:43 +01:00
|
|
|
* Released under the MIT License
|
|
|
|
*/`;
|
|
|
|
|
|
|
|
module.exports = [
|
2020-02-14 18:29:33 +01:00
|
|
|
// UMD builds
|
|
|
|
// dist/Chart.min.js
|
|
|
|
// dist/Chart.js
|
2019-10-27 23:28:25 +01:00
|
|
|
{
|
2020-02-14 18:29:33 +01:00
|
|
|
input,
|
2019-10-27 23:28:25 +01:00
|
|
|
plugins: [
|
2020-03-22 18:40:26 +01:00
|
|
|
polyfill(['resize-observer-polyfill', './platform/platform.dom.js']),
|
2020-02-20 15:41:47 +01:00
|
|
|
json(),
|
2019-10-27 23:28:25 +01:00
|
|
|
resolve(),
|
2020-02-14 18:29:33 +01:00
|
|
|
babel(),
|
2020-02-17 17:00:03 +01:00
|
|
|
cleanup({
|
|
|
|
sourcemap: true
|
|
|
|
})
|
2019-10-27 23:28:25 +01:00
|
|
|
],
|
|
|
|
output: {
|
|
|
|
name: 'Chart',
|
2020-02-14 18:29:33 +01:00
|
|
|
file: 'dist/Chart.js',
|
|
|
|
banner,
|
|
|
|
format: 'umd',
|
2019-10-27 23:28:25 +01:00
|
|
|
indent: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-02-14 18:29:33 +01:00
|
|
|
input,
|
2019-10-27 23:28:25 +01:00
|
|
|
plugins: [
|
2020-03-22 18:40:26 +01:00
|
|
|
polyfill(['resize-observer-polyfill', './platform/platform.dom.js']),
|
2020-02-20 15:41:47 +01:00
|
|
|
json(),
|
2019-10-27 23:28:25 +01:00
|
|
|
resolve(),
|
2020-02-14 18:29:33 +01:00
|
|
|
babel(),
|
2019-10-27 23:28:25 +01:00
|
|
|
terser({
|
|
|
|
output: {
|
|
|
|
preamble: banner
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
|
|
|
output: {
|
|
|
|
name: 'Chart',
|
2020-02-14 18:29:33 +01:00
|
|
|
file: 'dist/Chart.min.js',
|
|
|
|
format: 'umd',
|
2019-10-27 23:28:25 +01:00
|
|
|
indent: false,
|
|
|
|
},
|
|
|
|
},
|
2020-02-14 18:29:33 +01:00
|
|
|
|
|
|
|
// ES6 builds
|
|
|
|
// dist/Chart.esm.min.js
|
|
|
|
// dist/Chart.esm.js
|
2018-12-14 20:20:43 +01:00
|
|
|
{
|
2020-02-14 18:29:33 +01:00
|
|
|
input,
|
2018-12-14 20:20:43 +01:00
|
|
|
plugins: [
|
2020-02-20 15:41:47 +01:00
|
|
|
json(),
|
2018-12-14 20:20:43 +01:00
|
|
|
resolve(),
|
2020-02-22 00:55:53 +01:00
|
|
|
babel({envName: 'es6'}),
|
2020-02-17 17:00:03 +01:00
|
|
|
cleanup({
|
|
|
|
sourcemap: true
|
|
|
|
})
|
2018-12-14 20:20:43 +01:00
|
|
|
],
|
|
|
|
output: {
|
|
|
|
name: 'Chart',
|
2020-02-14 18:29:33 +01:00
|
|
|
file: 'dist/Chart.esm.js',
|
|
|
|
banner,
|
|
|
|
format: 'esm',
|
2018-12-14 20:20:43 +01:00
|
|
|
indent: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2020-02-14 18:29:33 +01:00
|
|
|
input,
|
2018-12-14 20:20:43 +01:00
|
|
|
plugins: [
|
2020-02-20 15:41:47 +01:00
|
|
|
json(),
|
2018-12-14 20:20:43 +01:00
|
|
|
resolve(),
|
2020-02-22 00:55:53 +01:00
|
|
|
babel({envName: 'es6'}),
|
2018-12-14 20:20:43 +01:00
|
|
|
terser({
|
|
|
|
output: {
|
|
|
|
preamble: banner
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
|
|
|
output: {
|
|
|
|
name: 'Chart',
|
2020-02-14 18:29:33 +01:00
|
|
|
file: 'dist/Chart.esm.min.js',
|
|
|
|
format: 'esm',
|
2018-12-14 20:20:43 +01:00
|
|
|
indent: false,
|
|
|
|
},
|
2020-02-14 18:29:33 +01:00
|
|
|
},
|
2018-12-14 20:20:43 +01:00
|
|
|
];
|