Skip to content

Commit

Permalink
bug symfony#1264 [Chart.js] Reverting chart.js type: module (weaverryan)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.x branch.

Discussion
----------

[Chart.js] Reverting chart.js type: module

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Issues        | Fix symfony#1262
| License       | MIT

This is complex, and relates to some hard/weird/broken changes that chart.js made in 3.9. Facts:

* Changing `type: module` and making no other changes breaks `chart.js` v3 (but v4 works fine)
* Changing the import from `chart.js/auto'` to `chart.js` - like symfony#1263 fixes things. However, it breaks the tests in 3.9... because chart.js doesn't have an `exports` key in that version, so our tests / node environment continue to load the `main` key instead of the `module` key.

So, this will "put thing back" and get chart.js working again.

After this, we should:

1) Re-add `type: module` to chart.js
2) Upgrade `chart.js` to v4

By doing that, other than actually migrating any custom chart.js code from 3 -> 4 (https://www.chartjs.org/docs/latest/migration/v4-migration.html), users won't need to make any other changes.

The question about 3 -> 4 is if we can do that in a minor UX version of it needs to be a major. Technically, nothing in `symfony/ux-chart.js` changes... except that it will force you to change a JS dep up a major version. It's a gray area.

Cheers!

Commits
-------

3fca0ca [Chart.js] Reverting chart.js type: module
  • Loading branch information
weaverryan committed Nov 9, 2023
2 parents de0d92a + 3fca0ca commit d4e3f0a
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/Chartjs/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"license": "MIT",
"version": "1.1.0",
"module": "dist/controller.js",
"type": "module",
"types": "dist/controller.d.ts",
"symfony": {
"controllers": {
Expand Down

0 comments on commit d4e3f0a

Please sign in to comment.