Skip to content

fix: declare runtime dependencies imported by published packages - #717

Merged
wschurman merged 1 commit into
expo:mainfrom
vatsalpatel:fix/declare-runtime-dependencies
Oct 9, 2026
Merged

wschurman merged 1 commit into
expo:mainfrom
vatsalpatel:fix/declare-runtime-dependencies

Conversation

@vatsalpatel

Copy link
Copy Markdown
Contributor

Why

A clean install of @expo/entity 0.70.0 fails on import:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@expo/nullthrows' imported from node_modules/@expo/entity/build/src/AuthorizationResultBasedEntityLoader.js

Five source files in packages/entity import @expo/nullthrows, but the package does not list it as a dependency. It is a devDependency of the two secondary cache packages, so inside this repo it gets hoisted and everything resolves. It looks like this came in with #517.

I checked the other published packages for the same thing and found three more:

  • @expo/entity-testing-utils imports invariant and uuid. A clean install fails with Cannot find package 'uuid'.
  • @expo/entity-database-adapter-knex-testing-utils imports @expo/entity-testing-utils. A clean install fails the same way.
  • @expo/entity-database-adapter-knex imports @expo/results. This one works under npm because @expo/entity depends on it and it gets hoisted. I did not reproduce a failure for it, but it would not resolve under an installer that does not hoist.

How

Added each missing package to dependencies of the package that imports it, with the same ranges the repo already uses for those packages, and ran yarn install to update the lockfile. No source changes.

Test Plan

Before, against the published packages, in an empty directory:

echo '{"type":"module"}' > package.json
npm install @expo/entity@0.70.0
node -e "await import('@expo/entity')"

This fails with the error above. The two testing-utils packages fail the same way on uuid and @expo/entity-testing-utils once @expo/nullthrows is installed by hand.

After, on this branch:

yarn build
yarn workspace @expo/entity pack --out /tmp/entity.tgz

Installing that tarball in an empty directory and importing @expo/entity works with nothing installed by hand. I did the same for the other three packages and checked that every import resolves.

yarn lint and yarn test pass. I did not run the integration tests locally.

A clean install of @expo/entity 0.70.0 fails on import with ERR_MODULE_NOT_FOUND for @expo/nullthrows. Five source files in the package import it, but it is only listed as a devDependency of the two secondary cache packages, so it resolves inside the monorepo and nowhere else.

Three other packages have the same problem:

- entity-testing-utils imports invariant and uuid
- entity-database-adapter-knex-testing-utils imports @expo/entity-testing-utils
- entity-database-adapter-knex imports @expo/results, which only resolves because @expo/entity depends on it and npm hoists it

Each is now listed under dependencies of the package that imports it.

Signed-off-by: vatsalpatel <vatsalpatel.me@gmail.com>
@vatsalpatel
vatsalpatel requested a review from wschurman as a code owner October 9, 2026 16:05
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (84f8307) to head (42e4797).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #717   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          110       110           
  Lines        18523     18523           
  Branches      1602      1602           
=========================================
  Hits         18523     18523           
Flag Coverage Δ
integration 30.72% <ø> (ø)
unittest 94.95% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wschurman wschurman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! Good catch!

@wschurman
wschurman merged commit 3c96f3b into expo:main Oct 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants