Skip to content

Add .js extensions to echarts/zrender deep imports (ESM / echarts 6 compat)#575

Open
alidor4702 wants to merge 1 commit into
ecomfe:masterfrom
alidor4702:fix/esm-import-extensions
Open

Add .js extensions to echarts/zrender deep imports (ESM / echarts 6 compat)#575
alidor4702 wants to merge 1 commit into
ecomfe:masterfrom
alidor4702:fix/esm-import-extensions

Conversation

@alidor4702

Copy link
Copy Markdown

Appends .js to the extensionless echarts/lib/... and zrender/lib/... deep imports in src/.

echarts 6 and zrender 6 added strict package exports maps ending in a "./*": "./*" catch-all, which resolve specifiers literally and no longer auto-append .js. As a result, strict-ESM bundlers (esbuild, Vite, Angular's esbuild builder) can't resolve echarts-gl's deep imports when it is consumed from source (echarts-gl/charts, echarts-gl/components, import 'echarts-gl'). Full details and a minimal repro are in #574.

The target files and their named exports are unchanged in echarts 6 / zrender 6 — only the .js extension was missing from the import specifiers. So this is a purely mechanical change:

  • No runtime behavior change.
  • webpack users are unaffected (webpack resolves both the extensionless and the .js form).
  • Unblocks strict-ESM bundlers and echarts 6 consumers.

Verification

  • An esbuild bundle of echarts-gl/charts against echarts 6.1.0 + zrender 6.1.0 resolves cleanly and registers scatter3D/grid3D (the same bundle fails with several "Could not resolve" errors without this change).
  • The 3D charts render correctly in a real Angular 18 application using the esbuild builder.

Fixes #574

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESM deep imports lack .js extensions → fail to bundle against echarts 6 / zrender 6 (strict exports)

1 participant