react-chartjs-2 icon indicating copy to clipboard operation
react-chartjs-2 copied to clipboard

[Bug]: latest react-chart-js2 5.2.0 doesn't work with storybook

Open psnb88 opened this issue 1 year ago • 4 comments

Would you like to work on a fix?

  • [ ] 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

| }; | class DatasetController {

static defaults = {}; | static datasetElementType = null; | static dataElementType = null;

Expected : storybooking react chart.js components should work.

Reproduction

NA

chart.js version

4.2.1

react-chartjs-2 version

5.2.0

Possible solution

Workaround tried:-

  • downgrading chartjs to 2.9.4 seems to work.
  • excluding files and folder which had reference to react-chart-js2 didn't work. code used for excluding filesand folder is below

webpackFinal: async (config, {configType}) => { config.module.rules.push({ test: /.js$/, exclude: [ path.resolve(__dirname, '../path/'), , ], }); return config; },

psnb88 avatar Apr 12 '23 11:04 psnb88

Works on my machine, Running 5.2.0 / 4.3.0

lkarvec avatar May 18 '23 18:05 lkarvec

I'm having the same issue, any progress on this?

SabrinaFZ avatar Jun 19 '23 15:06 SabrinaFZ

Same config as OP, same error here

enamodeka avatar Jun 23 '23 14:06 enamodeka

same here

rjousse18 avatar Aug 24 '23 14:08 rjousse18