You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "acdn-tsmith (via GitHub)" <gi...@apache.org> on 2026/09/18 18:28:11 UTC
[I] [Bug] v5 compatibility theme can register on a private ECharts instance in two-stage bundles [echarts]
acdn-tsmith opened a new issue, #21757:
URL: https://github.com/apache/echarts/issues/21757
### Version
6.1.0
### Link to Minimal Reproduction
https://gist.github.com/acdn-tsmith/e3f426c844217682dd6a2aedd4821b88
### Steps to Reproduce
1. Download the four files in the reproduction.
2. Run `npm install`.
3. Run `npm test`.
The reproduction performs two Rollup builds:
1. A reusable library imports `echarts/theme/v5.js`. Its build externalizes the public `echarts` package entry while processing the theme.
2. A consuming application imports both `echarts` and the built library, initializes an SSR chart with the `v5` theme, and reads the resolved color palette.
### Current Behavior
The theme's UMD CommonJS branch registers through its hard-coded `echarts/lib/echarts` dependency. A library build can therefore bundle that dependency as a private ECharts module instance while leaving the public `echarts` entry external.
The side-effect import registers `v5` on the private instance, not the ECharts instance used by the consuming application. The chart silently retains the ECharts 6 palette:
```text
Error: Expected v5 color #5470c6, received #5070dd
```
A direct, single-stage Node ESM import works. The failure is specific to multi-stage library/application bundling where package entry points can be handled differently.
### Expected Behavior
The documented migration pattern should register the v5 compatibility theme on the ECharts instance used by the consuming application:
```js
import * as echarts from 'echarts';
import 'echarts/theme/v5.js';
echarts.init(element, 'v5');
```
In the reproduction, the resolved first color should be the ECharts 5 value `#5470c6`.
### Environment
- OS: macOS
- Runtime: Node.js 26.8.1
- Bundler: Rollup 4.63.3
- Framework: none
### Any additional comments?
An ESM-specific theme entry that registers through the public bare `echarts` entry would avoid the private module identity while preserving the existing UMD file for CommonJS and direct browser-script consumers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org