You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: latest react-chart-js2 5.2.0 doesn't work with storybook #1166
Check this if you would like to implement a PR, we are more than happy to help you go through the process.
Current and expected behavior
Usage:- I use storybook( 6.5.13, webpack 4.6.4) ,react (react-scripts :5.0.1), react-chart-js2(5.2.0) ,chart.js(4.2.1) in my project.
Current behaviour :- npm run storybook throws exception " ERROR in ./node_modules/chart.js/dist/chart.js 568:17
Module parse failed: Unexpected token (568:17)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Closing: this is about how Chart.js itself behaves or is configured, while react-chartjs-2 passes data, options and plugins to Chart.js as they are. The Chart.js docs cover it: https://www.chartjs.org/docs/latest/ If it turns out to be a bug, please report it to Chart.js: https://github.com/chartjs/Chart.js/issues
Storybook 6 with webpack 4 cannot parse the class fields of the Chart.js 4 build; webpack 5 or a newer Storybook handles it.
Activity
lkarvec commentedon May 18, 2023
Works on my machine, Running 5.2.0 / 4.3.0
SabrinaFZ commentedon Jun 19, 2023
I'm having the same issue, any progress on this?
enamodeka commentedon Jun 23, 2023
Same config as OP, same error here
rjousse18 commentedon Aug 24, 2023
same here
dangreen commentedon Nov 30, 2026
Closing: this is about how Chart.js itself behaves or is configured, while react-chartjs-2 passes
data,optionsandpluginsto Chart.js as they are. The Chart.js docs cover it: https://www.chartjs.org/docs/latest/ If it turns out to be a bug, please report it to Chart.js: https://github.com/chartjs/Chart.js/issuesStorybook 6 with webpack 4 cannot parse the class fields of the Chart.js 4 build; webpack 5 or a newer Storybook handles it.