#961·orama

Circular dependencies / require cycle

Author: isaachinmanCreated Jul 30, 2025Updated Jun 27, 2026

Describe the bug

Surprised this has not been reported yet. I've used Orama previously with Vite as a bundler without issues.

I'm now setting up an Expo web/native project, and see these warnings:

 WARN  Require cycle: ../../../node_modules/@orama/orama/dist/esm/errors.js -> ../../../node_modules/@orama/orama/dist/esm/utils.js -> ../../../node_modules/@orama/orama/dist/esm/errors.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
 WARN  Require cycle: ../../../node_modules/@orama/orama/dist/esm/methods/search.js -> ../../../node_modules/@orama/orama/dist/esm/methods/search-fulltext.js -> ../../../node_modules/@orama/orama/dist/esm/methods/search.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
 WARN  Require cycle: ../../../node_modules/@orama/orama/dist/esm/methods/search.js -> ../../../node_modules/@orama/orama/dist/esm/methods/search-hybrid.js -> ../../../node_modules/@orama/orama/dist/esm/methods/search.js

These are not benign, it actually resulted in a fetchDocuments is not a function runtime error when calling the search function.

At the moment, the only workaround I can think of would be for users to bundle the entirety of the Orama source into a single file via esbuild or similar.

To Reproduce

  1. npx create-expo-app@latest test
  2. cd test && npm i @orama/orama
  3. npm run ios

Expected behavior

No require cycles – shared dependencies should be extracted to a third file to break the circularity.

Environment Info

bash
N/A

Affected areas

Search

Additional context

Edit: Seems as though this is not the first time: #181