Skip to content

Types broken with ECharts 5.5 + Vue 3 + moduleResolution: bundler #766

@kingyue737

Description

@kingyue737

Confirmation

  • I can confirm this problem is not reproducible with ECharts itself.

How are you introducing Vue-ECharts into your project?

ES Module imports

Versions

+-- @vitejs/plugin-vue@5.0.4
| `-- vue@3.4.19 deduped
+-- echarts@5.5.0
+-- vue-echarts@6.6.9
| +-- echarts@5.5.0 deduped
| +-- vue-demi@0.13.11
| | `-- vue@3.4.19 deduped
| `-- vue@3.4.19 deduped
`-- vue@3.4.19
  `-- @vue/server-renderer@3.4.19
    `-- vue@3.4.19 deduped

Details

Expected:
image

In fact:
image

I found that ECharts v5.5.0 does not add files of ./types/dist/ to exports in package.json like following:

{
  "exports":{
      "./types/dist/shared":"./types/dist/shared.js",
  }
}

End users need to import types from echarts/types/dist/shared.js instead of echarts/types/dist/shared when moduleResolution is bundler in tsconfig (recommended by vite, default in create-vue and will become default in nuxt). Although it doesn't matter if users only use ECharts itself, users of Vue ECharts will meet broken types as Vue ECharts imports echarts/types/dist/shared instead of echarts/types/dist/shared.js in its output:
image

Or should I request it in ECharts Repo?

Reproduction

https://stackblitz.com/edit/vitejs-vite-svx9rd

In the repro, npm run typecheck should have printed error because I've set :update-options="{ bug: 'bug' }". But the type-check passed because update-options is any here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions