algoliasearch-client-javascript icon indicating copy to clipboard operation
algoliasearch-client-javascript copied to clipboard

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

Open hayata-suenaga opened this issue 1 week ago • 3 comments

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

hayata-suenaga avatar Dec 06 '25 01:12 hayata-suenaga