Skip to content

Metro bundler fails to resolve internal modules of zrender due to invalid "exports" field in package.json (Android only) #251

@Kies8

Description

@Kies8

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions