Skip to content

fix: add physical app.plugin.js and exports map entry for Expo plugin resolver#160

Open
tan5166 wants to merge 2 commits into
callstackincubator:mainfrom
tan5166:fix/missing-app-plugin-js
Open

fix: add physical app.plugin.js and exports map entry for Expo plugin resolver#160
tan5166 wants to merge 2 commits into
callstackincubator:mainfrom
tan5166:fix/missing-app-plugin-js

Conversation

@tan5166
Copy link
Copy Markdown

@tan5166 tan5166 commented May 26, 2026

Problem

expo prebuild crashes when using @use-voltra/ios-client or @use-voltra/android-client as config plugins.

Expo's plugin resolver (resolveFrom in @expo/require-utils) resolves ${package}/app.plugin in two steps:

  1. Filesystem probe (lstatSync): checks if node_modules/${package}/app.plugin.js physically exists on disk, the exports map is not consulted here.
  2. Node native resolver fallback (Module._resolveFilename): queries the exports map for "./app.plugin" (no extension), fails because the existing entry is "./app.plugin.js" (with .js).

Both steps fail → Expo falls back to loading the main entry (build/commonjs/index.js), which imports native modules that cannot run in a Node.js context → crash.

Fix

Two complementary changes, each sufficient on its own, both applied for maximum compatibility:

1. Add a physical app.plugin.js shim at the package root
(fixes the filesystem probe — Step 1)

const plugin = require('./expo-plugin/app.plugin.js');
module.exports = plugin.default ?? plugin;

2. Add "./app.plugin" (no extension) to the exports map
(fixes the Node native resolver — Step 2)

"./app.plugin":    "./expo-plugin/app.plugin.js",
"./app.plugin.js": "./expo-plugin/app.plugin.js"

Closes #159

tan5166 added 2 commits May 27, 2026 01:35
…ient

Expo's plugin resolver uses filesystem-based lookup via resolveFrom and
does not follow package.json exports map. Without a physical app.plugin.js
at the package root, Expo falls back to loading the main entry
(build/commonjs/index.js), which imports native modules that cannot run
in a Node.js context during expo prebuild — causing a crash.
…solver

Expo's plugin resolver (resolveFrom in @expo/require-utils) queries
Module._resolveFilename('@use-voltra/ios-client/app.plugin') — without
the .js extension. The exports map only had './app.plugin.js', so the
lookup failed even with Node's native resolver.

Add './app.plugin' (no extension) alongside the existing './app.plugin.js'
so both explicit references and Expo's resolver work correctly.
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.

app.plugin.js missing at package root in v2 RC, expo prebuild fails with plugin resolution error

1 participant