Server Error when using annotation plugin with Chart.js 4.0.1 in NextJS app
See original GitHub issueHey guys,
First of all, thanks for making this super helpful library!
I am currently working on a NextJS and have implemented ChartJS v4.0.1. All works well, but when I want to install the annotation plugin and follow the steps of https://www.chartjs.org/chartjs-plugin-annotation/latest/guide/integration.html I get the following error:
My React component is: (only relevant is shown)
import {useEffect, useState} from "react";
import {BarElement, CategoryScale, Chart as ChartJS, Legend, LinearScale, Title, Tooltip} from 'chart.js';
import Annotation from 'chartjs-plugin-annotation';
import {Bar} from 'react-chartjs-2';
ChartJS.register(
CategoryScale,
LinearScale,
BarElement,
Title,
Tooltip,
Legend,
Annotation,
);
.........
Do you guys have any idea how to solve this? Is it an issue because of ChartJS v4?
Thanks a lot!
Cheers, Ferre
Issue Analytics
- State:
- Created 10 months ago
- Reactions:4
- Comments:12
Top Results From Across the Web
Issues · chartjs/chartjs-plugin-annotation - GitHub
Contribute to chartjs/chartjs-plugin-annotation development by creating ... Server Error when using annotation plugin with Chart.js 4.0.1 in NextJS app bug.
Read more >Next.js build error No "exports" main defined with chart.js
I am currently moving from craco (react-scripts) to Next.js but I have a problem in the build step. If I run the app...
Read more >chartjs-plugin-annotation-fix - npm
Annotations for Chart.js. Latest version: 0.5.8, last published: 4 years ago. Start using chartjs-plugin-annotation-fix in your project by ...
Read more >Integration | Chart.js
The examples below show how to load Chart.js in different systems. If you're using a front-end framework (e.g., React, Angular, or Vue), please ......
Read more >nx jest unexpected token 'export' - You.com | The AI Search ...
I use Jest to create and run the unit test used in my monorepo. Problem. When I run jest, on some test it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve been using the changes from the PR of @stockiNail with success using the following patch file for patch-package:
Don’t forget to remove the
.next
folder before runningnpm run dev
, or it will use a cached unpatched version of chartjs-plugin-annotation.Tested it with ChartJS@4.1.1 and annotation@2.1.0, works perfectly fine with box and line annotations!