// better with source mapping. In other cases, pick the minified build to
// make sure that the minification process (terser) doesn't break anything.
const regex = karma.autoWatch ? /chart\.js$/ : /chart\.min\.js$/;
- const build = builds.filter(v => v.output.file.match(regex))[0];
+ const build = builds.filter(v => v.output.file && v.output.file.match(regex))[0];
karma.set({
frameworks: ['jasmine'],
"url": "https://github.com/chartjs/Chart.js/issues"
},
"files": [
- "composer.json",
- "dist/*.css",
- "dist/*.js"
+ "dist/*.js",
+ "helpers/**/*.js"
],
"scripts": {
"autobuild": "rollup -c -w",
"eslint-config-chartjs": "^0.2.0",
"eslint-config-esnext": "^4.1.0",
"eslint-plugin-html": "^6.0.2",
+ "glob": "^7.1.6",
"jasmine": "^3.5.0",
"jasmine-core": "^3.5.0",
"karma": "^5.0.9",
const babel = require('rollup-plugin-babel');
const cleanup = require('rollup-plugin-cleanup');
+const glob = require('glob');
const inject = require('@rollup/plugin-inject');
const json = require('@rollup/plugin-json');
const resolve = require('@rollup/plugin-node-resolve').default;
const pkg = require('./package.json');
const input = 'src/index.js';
+const inputESM = {
+ 'dist/chart.esm': 'src/index.esm.js',
+};
+glob('src/helpers/helpers.*.js', (_er, files) => {
+ files.forEach(file => {
+ inputESM[file.replace(/src\/|helpers\.|\.js/g, '')] = file;
+ });
+});
const banner = `/*!
* Chart.js v${pkg.version}
},
// ES6 builds
- // dist/chart.esm.min.js
// dist/chart.esm.js
+ // helpers/*.js
{
- input,
+ input: inputESM,
plugins: [
json(),
resolve(),
})
],
output: {
- name: 'Chart',
- file: 'dist/chart.esm.js',
+ dir: './',
+ chunkFileNames: 'helpers/chunks/[name].js',
banner,
format: 'esm',
indent: false,
},
- },
- {
- input,
- plugins: [
- json(),
- resolve(),
- terser({
- output: {
- preamble: banner
- }
- })
- ],
- output: {
- name: 'Chart',
- file: 'dist/chart.esm.min.js',
- format: 'esm',
- indent: false,
- },
- },
+ }
];
--- /dev/null
+export * from './controllers';
+export * from './core';
+export * from './elements';
+export * from './platform';
+export * from './plugins';
+export * from './scales';