symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony

Home Page:https://ux.symfony.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ChartJS] Using chartjs/auto + importmap is not compatible with date adapters

simondaigre opened this issue · comments

Following this thread on Symfony Slack : https://symfony-devs.slack.com/archives/C01FN4EQNLX/p1709732205012939

The workaround seems hacky IMHO.
Maybe we should require chartjs only ?

Could you resume the problem and suggested workaround here ? As the Symfony Slack does not keep messages very long

Symfony UX requires chartjs/auto while Chart JS plugins require chartjs.
This is causing issues with assetmapper.

Workaround:

Almost got it, just need some advise how to resolve it properly.What I did:

    forced /auto  version to be 4.4.1
    in app.js I've just added import 'chartjs-adapter-date-fns'
    in app/assets/vendor/chartjs-adapter-date-fns/chartjs-adapter-date-fns.index.js

 there was import{_adapters as e}from"chart.js" which I've changed to import{_adapters as e}from"chart.js/auto"

But it requires to edit a vendor file...

I see this is duplicate of #1474 (comment) so we can close this issue.

I realise i stated something : #1263

@smnandre I just checked on my project, #1263 solves my issue.

@simondaigre I'm having difficulties to clean / finalize the PR #1263 in question.. would you take a look and see if you can help there.. ? :)

I think we're almost there but i'm fighting with CI errors / Chartjs 3.9.1