Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hotfix chart.js/auto for commonjs #10992

Merged
merged 2 commits into from Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
kurkle marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -7,6 +7,7 @@
"type": "module",
"sideEffects": [
"./auto/auto.js",
"./auto/auto.cjs",
"./dist/chart.umd.js"
],
"jsdelivr": "./dist/chart.umd.js",
Expand Down
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)
});