react-dsfr
react-dsfr copied to clipboard
Compatibility with @gouvfr/dsfr-chart 2.x
By default when installing @gouvfr/dsfr-chart, it will install version 2.x that is not compatible with react-dsfr. I got the following error when trying to use the bar chart component:
✘ [ERROR] Missing "./BarChart/bar-chart.common" specifier in "@gouvfr/dsfr-chart" package [plugin vite:dep-pre-bundle]
node_modules/@codegouvfr/react-dsfr/Chart/BarChart.js:4:7:
4 │ import "@gouvfr/dsfr-chart/BarChart/bar-chart.common";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This error came from the "onResolve" callback registered here:
node_modules/esbuild/lib/main.js:1151:20:
1151 │ let promise = setup({
╵ ^
at setup (file:///home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:16969:13)
at handlePlugins (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:1151:21)
at buildOrContextImpl (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:874:5)
at Object.buildOrContext (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:700:5)
at /home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:2039:68
at new Promise (<anonymous>)
at Object.context (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:2039:27)
at Object.context (/home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/esbuild/lib/main.js:1881:58)
at prepareEsbuildOptimizerRun (file:///home/tocab/Projects/Clients/IGN/cartes.gouv.fr/node_modules/vite/dist/node/chunks/dep-ByPKlqZ5.js:19170:33)
It would be great if react-dsfr can be compatible with version 2.x of @gouvfr/dsfr-chart
Also a lot of props are not exposed by the props of the React component (but exist in the @gouvfr/dsfr-chart web component).
Example it is possible de set the bar size in the bar component with:
<BarChart {...barChartData} barsize="24" />
It works but there is a typescript error because the barsize props is not declared inside BarChartProps.
Hey @tonai,
Sure! We just need to update it. Would you do be up for submitting a PR?
I'll try to have a look it
I found an issue on @gouvfr/dsfr-chart which is probably blocking the migration towards: 2.x https://github.com/GouvernementFR/dsfr-chart/issues/43
I have the same error, any plans for a fix?
I can review a PR
I am working on it but in order to be able to integrate version 2.x there are some issues that needs to be solved on dsfr charts part:
- https://github.com/GouvernementFR/dsfr-chart/pull/45
- https://github.com/GouvernementFR/dsfr-chart/pull/44
I created PR for both of them 3 weeks ago but still no news...
Thank you very much @tonai!