sgratzl / chartjs-chart-geo

Chart.js Choropleth and Bubble Maps
https://www.sgratzl.com/chartjs-chart-geo/
MIT License
347 stars 36 forks source link

ERR_UNSUPPORTED_DIR_IMPORT on Next js v12.1.6 typescript project #163

Closed andyjagoe closed 1 year ago

andyjagoe commented 1 year ago

When I import the package as follows into a Next js v12.1.6 typescript project

import { ChoroplethController, GeoFeature, ColorScale, ProjectionScale } from 'chartjs-chart-geo'

I receive the following error during build and/or run:

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Personal/Development/web3-analytics-app/node_modules/chart.js/helpers' is not supported resolving ES modules imported from /Personal/Development/web3-analytics-app/node_modules/chartjs-chart-geo/build/index.js
Did you mean to import chart.js/helpers/helpers.js?
    at new NodeError (node:internal/errors:387:5)
    at finalizeResolution (node:internal/modules/esm/resolve:326:17)
    at moduleResolve (node:internal/modules/esm/resolve:907:10)
    at defaultResolve (node:internal/modules/esm/resolve:1115:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:837:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  type: 'Error',
  code: 'ERR_UNSUPPORTED_DIR_IMPORT',
  url: 'file:///Personal/Development/web3-analytics-app/node_modules/chart.js/helpers'
}

Expected behavior

Can import package without error

Context

As a point of comparison, I'm able to do the below import for another chart.js plugin and use its matrix charts without problem in my project:

import { MatrixController, MatrixElement } from 'chartjs-chart-matrix'
sgratzl commented 1 year ago

which chart.js version are you using?

andyjagoe commented 1 year ago

3.8.0

On Sun, Jan 29, 2023 at 10:21 AM Samuel Gratzl @.***> wrote:

which chart.js version are you using?

— Reply to this email directly, view it on GitHub https://github.com/sgratzl/chartjs-chart-geo/issues/163#issuecomment-1407734749, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACWFJUZMJ2UGZE5T3UOXMLWU2YJHANCNFSM6AAAAAAUG3GR7Q . You are receiving this because you authored the thread.Message ID: @.***>

sgratzl commented 1 year ago

the latest version of this plugin is designed to be compatible with chart.js v4. https://github.com/sgratzl/chartjs-chart-geo/releases/tag/v3.10.0 is the last version which was designed for chart.js v3

andyjagoe commented 1 year ago

Got it. Makes sense. I’ll try it out

On Sun, Jan 29, 2023 at 10:35 AM Samuel Gratzl @.***> wrote:

the latest version of this plugin is designed to be compatible with chart.js v4. https://github.com/sgratzl/chartjs-chart-geo/releases/tag/v3.10.0 is the last version which was designed for chart.js v3

— Reply to this email directly, view it on GitHub https://github.com/sgratzl/chartjs-chart-geo/issues/163#issuecomment-1407737913, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACWFJWLNNDTF7XOPLCZHJTWU2Z5NANCNFSM6AAAAAAUG3GR7Q . You are receiving this because you authored the thread.Message ID: @.***>