hustcc / hustcc/echarts-for-react

Add tslib as dependency

Open
#512 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5k
Forks
650
PR merge metrics
No merged PRs in 30d

Description

Making an issue for this seeing as how #494 was closed without comment.

This library enables the `importHelpers` option in the tsconfig.json:

https://github.com/hustcc/echarts-for-react/blob/a35220e42c18b5f1714e31f61a8ba0f7f2f27334/tsconfig.json#L10

Per the [tsconfig docs](https://www.typescriptlang.org/tsconfig#importHelpers), when using this option, the [`tslib`](https://www.npmjs.com/package/tslib) module must be available to be imported at runtime. However, this library does not include tslib as a dependency, and instead relies that tslib will be available from another dependency at the top of the `node_modules` folder. The `echarts` peer dependency does include `tslib` as its own dependency, but depending on how the package manager decides to hoist, it may or may not be available, and so can lead to this module unexpectedly not working. This is happening to me in a monorepo and so we are using a fork of this library that adds tslib, an alternative would be that we need to install `tslib` in our `package.json` file.

This is similar to an issue `echarts` itself ran into last year: https://github.com/apache/echarts/pull/13573

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.