diff --git a/package.json b/package.json index 4aeb7d4f58b..c466ab5a156 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "license": "MIT", "jsdelivr": "dist/chart.min.js", "unpkg": "dist/chart.min.js", - "main": "dist/chart.js", + "main": "dist/chart.cjs", "module": "dist/chart.esm.js", "types": "types/index.esm.d.ts", "keywords": [ diff --git a/rollup.config.js b/rollup.config.js index 6f05bff34a7..8dc169dcad6 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -59,6 +59,28 @@ module.exports = [ }, }, + // CJS builds + // dist/chart.cjs + { + input, // for backwards-compatibility. should change to inputESM at 4.0 (and possibly rename that variable/file) + plugins: [ + json(), + resolve(), + cleanup({ + sourcemap: true + }), + analyze({summaryOnly: true}) + ], + output: { + name: 'Chart', + file: 'dist/chart.cjs', + exports: 'default', // for backwards-compatibility. should change to 'named' with 4.0 + banner, + format: 'cjs', + indent: false, + }, + }, + // ES6 builds // dist/chart.esm.js // helpers/*.js