2018-12-14 20:20:43 +01:00
|
|
|
/* eslint-env es6 */
|
|
|
|
|
|
|
|
const commonjs = require('rollup-plugin-commonjs');
|
|
|
|
const resolve = require('rollup-plugin-node-resolve');
|
2019-10-27 21:28:30 +01:00
|
|
|
const babel = require('rollup-plugin-babel');
|
2018-12-14 20:20:43 +01:00
|
|
|
const terser = require('rollup-plugin-terser').terser;
|
2019-01-29 17:54:22 +01:00
|
|
|
const optional = require('./rollup.plugins').optional;
|
2019-02-08 18:17:04 +01:00
|
|
|
const stylesheet = require('./rollup.plugins').stylesheet;
|
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';
|
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 = [
|
2019-11-02 20:48:49 +01:00
|
|
|
// ES6 builds
|
2019-10-27 23:28:25 +01:00
|
|
|
// dist/Chart.esm.min.js
|
|
|
|
// dist/Chart.esm.js
|
|
|
|
{
|
|
|
|
input: input,
|
|
|
|
plugins: [
|
|
|
|
resolve(),
|
|
|
|
commonjs(),
|
|
|
|
babel({
|
|
|
|
exclude: 'node_modules/**'
|
|
|
|
}),
|
|
|
|
stylesheet({
|
|
|
|
extract: true
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
output: {
|
|
|
|
name: 'Chart',
|
|
|
|
file: 'dist/Chart.esm.js',
|
|
|
|
banner: banner,
|
|
|
|
format: 'esm',
|
|
|
|
indent: false,
|
|
|
|
globals: {
|
|
|
|
moment: 'moment'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
external: [
|
|
|
|
'moment'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: input,
|
|
|
|
plugins: [
|
|
|
|
resolve(),
|
|
|
|
commonjs(),
|
|
|
|
babel({
|
|
|
|
exclude: 'node_modules/**'
|
|
|
|
}),
|
|
|
|
stylesheet({
|
|
|
|
extract: true,
|
|
|
|
minify: true
|
|
|
|
}),
|
|
|
|
terser({
|
|
|
|
output: {
|
|
|
|
preamble: banner
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
|
|
|
output: {
|
|
|
|
name: 'Chart',
|
|
|
|
file: 'dist/Chart.esm.min.js',
|
|
|
|
format: 'esm',
|
|
|
|
indent: false,
|
|
|
|
globals: {
|
|
|
|
moment: 'moment'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
external: [
|
|
|
|
'moment'
|
|
|
|
]
|
|
|
|
},
|
2019-11-02 20:48:49 +01:00
|
|
|
// UMD builds
|
2018-12-14 20:20:43 +01:00
|
|
|
// dist/Chart.min.js
|
|
|
|
// dist/Chart.js
|
|
|
|
{
|
|
|
|
input: input,
|
|
|
|
plugins: [
|
|
|
|
resolve(),
|
2019-01-29 17:54:22 +01:00
|
|
|
commonjs(),
|
2019-10-27 21:28:30 +01:00
|
|
|
babel({
|
|
|
|
exclude: 'node_modules/**'
|
|
|
|
}),
|
2019-02-08 18:17:04 +01:00
|
|
|
stylesheet({
|
|
|
|
extract: true
|
|
|
|
}),
|
2019-01-29 17:54:22 +01:00
|
|
|
optional({
|
|
|
|
include: ['moment']
|
|
|
|
})
|
2018-12-14 20:20:43 +01:00
|
|
|
],
|
|
|
|
output: {
|
|
|
|
name: 'Chart',
|
|
|
|
file: 'dist/Chart.js',
|
|
|
|
banner: banner,
|
|
|
|
format: 'umd',
|
|
|
|
indent: false,
|
|
|
|
globals: {
|
|
|
|
moment: 'moment'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
external: [
|
|
|
|
'moment'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: input,
|
|
|
|
plugins: [
|
|
|
|
resolve(),
|
|
|
|
commonjs(),
|
2019-10-27 21:28:30 +01:00
|
|
|
babel({
|
|
|
|
exclude: 'node_modules/**'
|
|
|
|
}),
|
2019-01-29 17:54:22 +01:00
|
|
|
optional({
|
|
|
|
include: ['moment']
|
|
|
|
}),
|
2019-02-08 18:17:04 +01:00
|
|
|
stylesheet({
|
|
|
|
extract: true,
|
|
|
|
minify: true
|
|
|
|
}),
|
2018-12-14 20:20:43 +01:00
|
|
|
terser({
|
|
|
|
output: {
|
|
|
|
preamble: banner
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
|
|
|
output: {
|
|
|
|
name: 'Chart',
|
|
|
|
file: 'dist/Chart.min.js',
|
|
|
|
format: 'umd',
|
|
|
|
indent: false,
|
|
|
|
globals: {
|
|
|
|
moment: 'moment'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
external: [
|
|
|
|
'moment'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
];
|