Repository navigation
fix: declare tslib as a runtime dependency - #630
Merged
Merged
Conversation
The build uses importHelpers, so lib/ and esm/ import tslib at runtime, but it was not declared. It only resolved when another package happened to put it within reach, and failed under strict installs such as pnpm with hoist=false. Fixes hustcc#512
hustcc
approved these changes
Nov 7, 2026
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change declaring tslib as a runtime dependency.
No open issues 🎉
What changed in this PR
Addresses #512 by declaring tslib as a runtime dependency, so the compiled library no longer relies on another package making TypeScript helpers available through dependency hoisting.
Changes:
- Adds
tslib: ^2.3.0to runtime dependencies, matching the range used by echarts 5 and 6.
| File | Description |
|---|---|
package.json |
Declares the runtime dependency required by the compiled CommonJS and ES module builds. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #512
The build uses
importHelpers, solib/andesm/importtslibat runtime (__assign,__awaiter,__extends,__generatorand__rest, plus__importDefaultand__importStarin the CJS build).tslibisn't declared as a dependency, so it only resolves when another package, usuallyecharts, happens to put it within reach ofecharts-for-react.This adds
tslib: ^2.3.0todependencies, the same rangeecharts5 and 6 use, so package managers can share one copy.Tested by packing the package before and after and installing each with pnpm 9, React 19 and echarts 6:
hoist=false: before,require('echarts-for-react')fails withCannot find module 'tslib'. After, it loads.Jest passes (13/13). The only lint errors are the two existing
@ts-ignoreones in__tests__/charts/simple-spec.tsx, which are onmastertoo.#494 made the same change in 2022 and was closed without a comment. If there's a reason to prefer another approach, for example raising the build target so the helpers aren't needed, I'm happy to switch.