chartjs-plugin-datalabels: Error running the latest chartjs-plugin-datalabels with NextJS
Hello,
I am developing a NextJS site and I installed the latest “chartjs-plugin-datalabels”.
When I am running my project I got the following error:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './helpers' is not defined by "exports" in /Users/zaralisandreas/Desktop/Projects/odify/node_modules/chart.js/package.json
I am using Node v18.12.1 and Chart.js 4.0.1.
Any ideas?
I really appreciate any help you can provide.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 10
- Comments: 21 (7 by maintainers)
@simonbrunel I think the plugin must be defined as “module” and defines the exports. See https://github.com/chartjs/chartjs-plugin-annotation/pull/815 and other plugins (gradient https://github.com/kurkle/chartjs-plugin-gradient/blob/master/package.json)
That’s a good news! Thanks @Fish1 and @DecadentIpsum for checking and keep us updated.
@dqve @ignaciodiazb @NotTimTam @epleaner @dahsser can you guys also confirm that Chart 4.1.1 fixes your issue?
Noticed that chartjs 4.1.1 was released yesterday.
Bumped up the version to 4.1.1 in the previously shared codesandbox, and all appears to be working!
https://codesandbox.io/s/objective-panka-ewx6tu
I had the same problem using nextJs. Chart.js 4.1.1 and chartjs-plugin-datalabels 2.2.0 worked perfectly
Yes. chart.js 4.1.1 solves the problem
Also getting this with “next”: “13.0.3”, “chart.js”: “4.0.1”, and “chartjs-plugin-datalabels”: “2.2.0”.
Hopefully a fix is coming in soon.
@simonbrunel thanks a lot for your interest in resolving this issue 🙂
Here is a minimal repo with the reproduction of the issue https://codesandbox.io/s/elated-haze-d3fj4w?file=/pages/index.js
Thanks @stockiNail for the info. While you are probably right, I don’t want to blindly push these changes but first would like to experiment with the reported cases. Also, we need to be sure that it doesn’t break existing integrations since changing
type: "module"may have broader implications.@DecadentIpsum @dqve @ignaciodiazb @NotTimTam can one of you please share a minimal repo that reproduces this issue? I’m not familiar with Next.js and don’t have much time to figure out by myself.