Skip to content

Commit addc1f8

Browse files
committed
Fix Chart.js encore compilation
1 parent 44f5193 commit addc1f8

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

src/Chartjs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.18.0
4+
5+
- Replace `chartjs/auto` import with explicit `Chart.register()` call #1263
6+
37
## 2.17.0
48

59
- Add `chartjs:view-value-change` event #1605

src/Chartjs/assets/dist/controller.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { Controller } from '@hotwired/stimulus';
2-
import Chart from 'chart.js/auto';
2+
import { registerables, Chart } from 'chart.js';
33

4+
if (registerables != undefined) {
5+
Chart.register(...registerables);
6+
}
47
let isChartInitialized = false;
58
class default_1 extends Controller {
69
constructor() {

src/Chartjs/assets/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "Chart.js integration for Symfony",
44
"license": "MIT",
55
"version": "1.1.0",
6+
"type": "module",
67
"main": "dist/controller.js",
78
"types": "dist/controller.d.ts",
89
"symfony": {
@@ -16,7 +17,7 @@
1617
},
1718
"importmap": {
1819
"@hotwired/stimulus": "^3.0.0",
19-
"chart.js/auto": "^3.4.1 || ^4.0"
20+
"chart.js": "^3.4.1 || ^4.0"
2021
}
2122
},
2223
"peerDependencies": {
@@ -25,7 +26,6 @@
2526
},
2627
"devDependencies": {
2728
"@hotwired/stimulus": "^3.0.0",
28-
"@types/chart.js": "^2.9.34",
2929
"chart.js": "^3.4.1 || ^4.0",
3030
"resize-observer-polyfill": "^1.5.1",
3131
"vitest-canvas-mock": "^0.3.3"

src/Chartjs/assets/src/controller.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
'use strict';
1111

1212
import { Controller } from '@hotwired/stimulus';
13-
import Chart from 'chart.js/auto';
13+
import { Chart, registerables } from 'chart.js';
14+
15+
// ChartJs 3.x
16+
if (registerables != undefined) {
17+
Chart.register(...registerables);
18+
}
1419

1520
let isChartInitialized = false;
1621

yarn.lock

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
resolved "https://registry.npmjs.org/@hotwired/stimulus/-/stimulus-3.2.1.tgz"
21282128
integrity sha512-HGlzDcf9vv/EQrMJ5ZG6VWNs8Z/xMN+1o2OhV1gKiSG6CqZt5MCBB1gRg5ILiN3U0jEAxuDTNPRfBcnZBDmupQ==
21292129

2130-
"@hotwired/turbo@^8.0":
2130+
"@hotwired/turbo@^7.1.0 || ^8.0":
21312131
version "8.0.4"
21322132
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-8.0.4.tgz#5c5361c06a37cdf10dcba4223f1afd0ca1c75091"
21332133
integrity sha512-mlZEFUZrJnpfj+g/XeCWWuokvQyN68WvM78JM+0jfSFc98wegm259vCbC1zSllcspRwbgXK31ibehCy5PA78/Q==
@@ -2829,13 +2829,6 @@
28292829
resolved "https://registry.npmjs.org/@types/chai/-/chai-4.3.9.tgz"
28302830
integrity sha512-69TtiDzu0bcmKQv3yg1Zx409/Kd7r0b5F1PfpYJfSHzLGtB53547V4u+9iqKYsTu/O2ai6KTb0TInNpvuQ3qmg==
28312831

2832-
"@types/chart.js@^2.9.34":
2833-
version "2.9.37"
2834-
resolved "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.37.tgz"
2835-
integrity sha512-9bosRfHhkXxKYfrw94EmyDQcdjMaQPkU1fH2tDxu8DWXxf1mjzWQAV4laJF51ZbC2ycYwNDvIm1rGez8Bug0vg==
2836-
dependencies:
2837-
moment "^2.10.2"
2838-
28392832
"@types/estree@*", "@types/estree@^1.0.0":
28402833
version "1.0.0"
28412834
resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz"
@@ -6695,9 +6688,9 @@ magic-string@^0.30.1, magic-string@^0.30.3:
66956688
"@jridgewell/sourcemap-codec" "^1.4.15"
66966689

66976690
magic-string@^0.30.4:
6698-
version "0.30.8"
6699-
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.8.tgz#14e8624246d2bedba70d5462aa99ac9681844613"
6700-
integrity sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==
6691+
version "0.30.9"
6692+
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.9.tgz#8927ae21bfdd856310e07a1bc8dd5e73cb6c251d"
6693+
integrity sha512-S1+hd+dIrC8EZqKyT9DstTH/0Z+f76kmmvZnkfQVmOpDEF9iVgdYif3Q/pIWHmCoo59bQVGW0kVL3e2nl+9+Sw==
67016694
dependencies:
67026695
"@jridgewell/sourcemap-codec" "^1.4.15"
67036696

@@ -6891,11 +6884,6 @@ mlly@^1.2.0, mlly@^1.4.0:
68916884
pkg-types "^1.0.3"
68926885
ufo "^1.3.0"
68936886

6894-
moment@^2.10.2:
6895-
version "2.29.4"
6896-
resolved "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz"
6897-
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
6898-
68996887
moo-color@^1.0.2:
69006888
version "1.0.3"
69016889
resolved "https://registry.npmjs.org/moo-color/-/moo-color-1.0.3.tgz"
@@ -8614,9 +8602,9 @@ svelte-hmr@^0.15.3:
86148602
integrity sha512-41snaPswvSf8TJUhlkoJBekRrABDXDMdpNpT2tfHIv4JuhgvHqLMhEPGtaQn0BmbNSTkuz2Ed20DF2eHw0SmBQ==
86158603

86168604
"svelte@^3.0 || ^4.0":
8617-
version "4.2.12"
8618-
resolved "https://registry.yarnpkg.com/svelte/-/svelte-4.2.12.tgz#13d98d2274d24d3ad216c8fdc801511171c70bb1"
8619-
integrity sha512-d8+wsh5TfPwqVzbm4/HCXC783/KPHV60NvwitJnyTA5lWn1elhXMNWhXGCJ7PwPa8qFUnyJNIyuIRt2mT0WMug==
8605+
version "4.2.14"
8606+
resolved "https://registry.yarnpkg.com/svelte/-/svelte-4.2.14.tgz#36e5d2f2bcf8fed178cc65d2a9dce55ea97f6625"
8607+
integrity sha512-ry3+YlWqZpHxLy45MW4MZIxNdvB+Wl7p2nnstWKbOAewaJyNJuOtivSbRChcfIej6wFBjWqyKmf/NgK1uW2JAA==
86208608
dependencies:
86218609
"@ampproject/remapping" "^2.2.1"
86228610
"@jridgewell/sourcemap-codec" "^1.4.15"

0 commit comments

Comments
 (0)