Skip to content

fix(plugin-chart-echarts): use echarts 5.6.0 i18n export path for locale import - #42055

Merged
eschutho merged 1 commit into
masterfrom
fix-echarts-i18n-dynamic-import
Jul 15, 2026
Merged

fix(plugin-chart-echarts): use echarts 5.6.0 i18n export path for locale import#42055
eschutho merged 1 commit into
masterfrom
fix-echarts-i18n-dynamic-import

Conversation

@eschutho

Copy link
Copy Markdown
Member

Summary

Fixes a webpack build warning introduced when echarts 5.6.0 added a package.json exports field.

Root cause

echarts 5.6.0 added exports to its package.json. The catch-all entry "./*": "./*" maps echarts/lib/i18n./lib/i18n (no .js extension). webpack 5's enhanced-resolve with fullySpecified: true then fails to find the file because it requires an exact match (no extension guessing), producing:

WARNING in ./plugins/plugin-chart-echarts/src/components/Echart.tsx
Module not found: Error: Package path ./lib/i18n is exported from package echarts,
but no valid target file was found (see exports field in .../node_modules/echarts/package.json)

Fix

Switch the dynamic locale import from echarts/lib/i18n/lang${locale} to echarts/i18n/lang${locale}.js.

  • echarts/i18n/ is an explicit export pattern in echarts 5.6.0: "./i18n/*": "./i18n/*"
  • The locale files (i18n/langEN.js, i18n/langZH.js, etc.) exist at the package root i18n/ directory
  • The explicit .js extension satisfies enhanced-resolve's fullySpecified mode

Testing

  • cd superset-frontend && npm run build completes without the lib/i18n warning
  • Chart locale loading works correctly (locale changes apply to ECharts charts)

…ale import

echarts 5.6.0 added a package.json exports field. The catch-all
"./*": "./*" entry maps "./lib/i18n" to itself with no .js extension.
webpack 5's enhanced-resolve with fullySpecified=true then fails to
resolve the file, producing a build warning.

Fix by switching to the top-level `i18n/` export path (`./i18n/*`)
which is an explicit entry in the echarts 5.6.0 exports field, and
adding the explicit `.js` extension so enhanced-resolve can find the
file under fullySpecified mode.

The locale files (langEN.js, langZH.js, etc.) exist in echarts' i18n/
directory at the package root.

Co-Authored-By: Claude <noreply@anthropic.com>
@dosubot dosubot Bot added change:frontend Requires changing the frontend i18n Namespace | Anything related to localization viz:charts:echarts Related to Echarts labels Jul 15, 2026
@bito-code-review

bito-code-review Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #f344ca

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx - 1
    • Missing unit test coverage · Line 127-127
      The import path change (`echarts/lib/i18n/` → `echarts/i18n/`) aligns with ECharts 6.x structure. The try-catch at line 128-130 provides graceful degradation, but there's no test coverage for this code path. Consider adding a unit test that verifies `loadLocale` behavior with valid locales, missing locales, and edge cases like empty strings.
Review Details
  • Files reviewed - 1 · Commit Range: 8a8d1e5..8a8d1e5
    • superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added plugins and removed i18n Namespace | Anything related to localization labels Jul 15, 2026
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.49%. Comparing base (d68e84e) to head (8a8d1e5).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #42055   +/-   ##
=======================================
  Coverage   64.49%   64.49%           
=======================================
  Files        2747     2747           
  Lines      153843   153843           
  Branches    35268    35268           
=======================================
  Hits        99221    99221           
  Misses      52712    52712           
  Partials     1910     1910           
Flag Coverage Δ
javascript 70.46% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eschutho
eschutho requested a review from rebenitez1802 July 15, 2026 16:10

@rebenitez1802 rebenitez1802 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against the pinned echarts 6.1.0 exports map and a real Node resolution test: the old echarts/lib/i18n/* path has no matching export entry (hard resolution failure), the new echarts/i18n/*.js path matches "./i18n/*": "./i18n/*" and resolves correctly. No other call sites use the old path. Clean fix.

@eschutho
eschutho merged commit beb9d53 into master Jul 15, 2026
72 checks passed
@eschutho
eschutho deleted the fix-echarts-i18n-dynamic-import branch July 15, 2026 18:45
rdg0 pushed a commit to rdg0/superset that referenced this pull request Jul 20, 2026
…ale import (apache#42055)

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend plugins size/XS viz:charts:echarts Related to Echarts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants