wuba / wuba/react-native-echarts
Metro bundler fails to resolve internal modules of zrender due to invalid "exports" field in package.json (Android only)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 967
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
I am using echarts in my project. I do not use zrender directly in my code, but since echarts depends on it, Metro tries to resolve it during bundling.
On Android, Metro bundler throws errors related to the "exports" field defined in zrender’s package.json.
WARN The package ~/node_modules/zrender contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).
Reason: The resolution for "~/node_modules/zrender/lib/core/platform" defined in "exports" is ~/node_modules/zrender/lib/core/platform, however this file does not exist. Falling back to file-based resolution.
WARN The package ~/node_modules/zrender contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).
Reason: The resolution for "~/node_modules/zrender/lib/zrender" defined in "exports" is ~/node_modules/zrender/lib/zrender, however this file does not exist. Falling back to file-based resolution.
WARN The package ~/node_modules/zrender contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).
Reason: The resolution for "~/node_modules/zrender/lib/svg/helper" defined in "exports" is ~/node_modules/zrender/lib/svg/helper, however this file does not exist. Falling back to file-based resolution.
WARN The package ~/node_modules/zrender contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).
Reason: The resolution for "~/node_modules/zrender/lib/graphic/Path" defined in "exports" is ~/node_modules/zrender/lib/graphic/Path, however this file does not exist. Falling back to file-based resolution.
WARN The package ~/node_modules/zrender contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).
Reason: The resolution for "~/node_modules/zrender/lib/graphic/Image" defined in "exports" is ~/node_modules/zrender/lib/graphic/Image, however this file does not exist. Falling back to file-based resolution.
WARN The package ~/node_modules/zrender contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).
Reason: The resolution for "~/node_modules/zrender/lib/graphic/TSpan" defined in "exports" is ~/node_modules/zrender/lib/graphic/TSpan, however this file does not exist. Falling back to file-based resolution.
WARN The package ~/node_modules/zrender contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).
Reason: The resolution for "~/node_modules/zrender/lib/canvas/dashStyle" defined in "exports" is ~/node_modules/zrender/lib/canvas/dashStyle, however this file does not exist. Falling back to file-based resolution.
WARN The package ~/node_modules/zrender contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).
Reason: The resolution for "~/node_modules/zrender/lib/svg/mapStyleToAttrs" defined in "exports" is ~/node_modules/zrender/lib/svg/mapStyleToAttrs, however this file does not exist. Falling back to file-based resolution.
The "exports" field in zrender/package.json contains paths like:
"exports": {
"./lib/core/platform": "./lib/core/platform",
"./lib/zrender": "./lib/zrender"
}
However, Metro expects these to resolve to actual .js files, but they don’t exist (e.g., lib/zrender.js is not present). This is problematic for Metro's resolution mechanism on Android, which strictly follows the "exports" field.
| Library | Version |
|---|---|
| @wuba/react-native-echarts | "^2.0.3" |
| echarts | "^5.6.0" |
| React Native | "0.79.2" |
| Platform | Android (only) |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Android bundling warning with the listed React Native, echarts, and @wuba/react-native-echarts versions. Inspect zrender/package.json and its exports entries, especially ./lib/core/platform and ./lib/zrender, then verify that the affected paths resolve to existing files without Metro warnings. No repository test or source file is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, react-native
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100