Skip to content

Commit

Permalink
fix: hotfix chart.js/auto for commonjs
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen committed Dec 16, 2022
1 parent 1fddec4 commit 6cbcd55
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions auto/auto.cjs
@@ -1,6 +1,6 @@
const exports = require('../dist/chart.cjs');
const {Chart, registerables} = exports;
const chartjs = require('../dist/chart.cjs');
const {Chart, registerables} = chartjs;

Chart.register(...registerables);

module.exports = Object.assign(Chart, exports);
module.exports = Object.assign(Chart, chartjs);
4 changes: 3 additions & 1 deletion test/integration/node-commonjs/package.json
Expand Up @@ -2,7 +2,9 @@
"private": true,
"description": "chart.js should work in Node",
"scripts": {
"test": "node test.js"
"test": "npm run test-index && npm run test-auto",
"test-index": "node test.js",
"test-auto": "node test-auto.js"
},
"dependencies": {
"chart.js": "workspace:*"
Expand Down
7 changes: 7 additions & 0 deletions test/integration/node-commonjs/test-auto.js
@@ -0,0 +1,7 @@
const Chart = require('chart.js/auto');
const {valueOrDefault} = require('chart.js/helpers');

Chart.register({
id: 'TEST_PLUGIN',
dummyValue: valueOrDefault(0, 1)
});

0 comments on commit 6cbcd55

Please sign in to comment.