Skip to content

[bug]: Invalid package.json exports configuration causes Metro bundler warning #1600

Closed
algolia/api-clients-automation
#5740

Description

@hayata-suenaga

Description

The wildcard exports patterns in package.json cause Metro bundler (used by Expo/React Native) to produce warnings about non-existent files.

Warning Message

WARN  The package /Users/.../node_modules/algoliasearch contains an invalid package.json configuration. Consider raising this issue with the package maintainer(s).

Reason: The resolution for "/Users/.../node_modules/algoliasearch/dist/lite/builds/browser.js" defined in "exports" is /Users/.../node_modules/algoliasearch/dist/lite/builds/browser.js.js, however this file does not exist. Falling back to file-based resolution.

Root Cause

The following wildcard exports patterns in package.json are causing the issue:

"exports": {
  ...
  "./dist/*": "./dist/*.js",
  "./dist/lite/builds/*": "./dist/lite/builds/*.js"
}

When Metro resolves ./dist/lite/builds/browser.js, the wildcard pattern ./dist/lite/builds/* captures browser.js as the * portion, and then substitutes it into ./dist/lite/builds/*.js, resulting in ./dist/lite/builds/browser.js.js — which doesn't exist.

Environment

  • algoliasearch version: 5.46.0
  • Bundler: Metro (via Expo)
  • Platform: React Native / Expo

Client

Search

Version

5.46.0

Activity

  1. Kungpowpow commented on Dec 7, 2025

    @Kungpowpow

    +1

  2. self-assigned this
    on Dec 8, 2025
  3. Fluf22 commented on Dec 9, 2025

    @Fluf22
    Contributor

    Hey @hayata-suenaga
    Do you have a minimal repro project please?
    I can't manage to get the same warning than you, even if I understand the issue, and I would like to check I'm not doing any mistake before fixing it

  4. hayata-suenaga commented on Dec 11, 2025

    @hayata-suenaga
    Author

    I can put together a minimal repro tomorrow. In the meantime, you should be able to reproduce the issue by initializing any new Expo project and installing algoliasearch in it.

  5. ottob commented on Mar 10, 2026

    @ottob

    Any updates on this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions