Chart js doesnt work in Vaadin 23

I have imported the dependency of chart.js 0.1.38 in the pom.xml, but when I ran the project I got this error message

2022-12-21 15:40:01.256  INFO 16836 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : [vite] Failed to load source map for /generated/jar-resources/chart/hammer.min.js.```

Can you show the dependency you used? How did you use the component?

I am using this dependency <!-- https://mvnrepository.com/artifact/org.vaadin.addons.chartjs/chartjs --> <dependency> <groupId>org.vaadin.addons.chartjs</groupId> <artifactId>chartjs</artifactId> <version>0.1.38</version> </dependency> this is my pom.xml https://gist.github.com/GarnicaJR/f2d43d14fd7159f97966d8b16361e92f and I am using this java code ``` BarChartConfig config = new BarChartConfig();
config
.data()
.labels(“January”, “February”, “March”, “April”, “May”, “June”, “July”)
.addDataset(new BarDataset().type().label(“Dataset 1”).backgroundColor(“rgba(151,187,205,0.5)”).borderColor(“white”).borderWidth(2))
.addDataset(new LineDataset().type().label(“Dataset 2”).backgroundColor(“rgba(151,187,205,0.5)”).borderColor(“white”).borderWidth(2))
.addDataset(new BarDataset().type().label(“Dataset 3”).backgroundColor(“rgba(220,220,220,0.5)”))
.and();

    config.
            options()
            .responsive(true)
            .title()
            .display(true)
            .position(Position.LEFT)
            .text("Chart.js Combo Bar Line Chart")
            .and()
            .done();

    List<String> labels = config.data().getLabels();
    for (Dataset<?, ?> ds : config.data().getDatasets()) {
        List<Double> data = new ArrayList<>();
        for (int i = 0; i < labels.size(); i++) {
            data.add((double) (Math.random() > 0.5 ? 1.0 : -1.0) * Math.round(Math.random() * 100));
        }

        if (ds instanceof BarDataset) {
            BarDataset bds = (BarDataset) ds;
            bds.dataAsList(data);
        }

        if (ds instanceof LineDataset) {
            LineDataset lds = (LineDataset) ds;
            lds.dataAsList(data);
        }
    }

    ChartJs chart = new ChartJs(config);
    add(chart);```

I recommend to fallback webpack using feature flags.

Based on discussion here it looks like underlying chart.js library is not compatible with Vite https://laracasts.com/discuss/channels/vite/using-chartjs-with-vite

I used webpack instead of vite as you mentioned and now it is working,
image.png

com.vaadin.experimental.webpackForFrontendBuild=true in the vaadin-featureflags.properties file