chartjs-plugin-annotation: import from chart.js cause "cannot use import statement outside a module"

Hello, When I try to import annotation plugin at NodeJS as follows import annotation from 'chartjs-plugin-annotation' it is causing an error like below annotation_bug

So What I have done to fix it is I downgrade to 2.0.0 and change chartjs-plugin-annotation.esm as follows

import { Element, defaults, Animations, Chart } from 'chart.js/auto' and everything work fines. (That fix doesn’t work at ver 2.1.0)

annotation_bug_2

May I know what is wrong in here as I don’t find similar issue mentioned or Is it only happening to me

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 22

Most upvoted comments

@echo178 I have reopened the issue because the solution could be to set the plugin as module (and not add node exports).

@echo178 the PR is not merged yet and available. You should wait for a while 😉