vitest ERR_PACKAGE_PATH_NOT_EXPORTED
hugo-valcourt opened this issue · 3 comments
hugo-valcourt commented
Hi,
I'am investigating on a problem when testing component using Chart.js chartjs-plugin-annotation on vitest.
I got the error ERR_PACKAGE_PATH_NOT_EXPORTED.
Maybe related to chartjs-plugin-zoom bug chartjs/chartjs-plugin-zoom#709
When I remove "chartjs-plugin-annotation" and "chartjs-plugin-zoom" everything is working.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: No "exports" main defined in /.../node_modules/chart.js/package.json
"chart.js": "^4.0.1",
"chartjs-adapter-luxon": "^1.3.0",
"chartjs-plugin-annotation": "^2.1.0",
"chartjs-plugin-zoom": "^2.0.0",
"@vue/test-utils": "^2.2.6",
"jsdom": "^20.0.3",
"vitest": "^0.25.6",
"vitest-canvas-mock": "^0.2.2",
❯ node_modules/chartjs-plugin-annotation/dist/chartjs-plugin-annotation.js:8:89
6| */
7| (function (global, factory) {
8| typeof exports === 'object' && typeof module !== 'undefi…
| ^
9| typeof define === 'function' && define.amd ? define(['ch…
10| (global = typeof globalThis !== 'undefined' ? globalThis…
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: {
"code": "ERR_PACKAGE_PATH_NOT_EXPORTED",
}
stockiNail commented
See issue #814
A PR is already submitted. It needs to be of last update
stockiNail commented
@hugo-valcourt could you try with new CHART.JS version 4.1.1? With that version and plugin 2.1.0, it should work.
hugo-valcourt commented
working after upgrade! thanks!