fix: add physical app.plugin.js and exports map entry for Expo plugin resolver#160
Open
tan5166 wants to merge 2 commits into
Open
fix: add physical app.plugin.js and exports map entry for Expo plugin resolver#160tan5166 wants to merge 2 commits into
tan5166 wants to merge 2 commits into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
expo prebuildcrashes when using@use-voltra/ios-clientor@use-voltra/android-clientas config plugins.Expo's plugin resolver (
resolveFromin@expo/require-utils) resolves${package}/app.pluginin two steps:lstatSync): checks ifnode_modules/${package}/app.plugin.jsphysically exists on disk, theexportsmap is not consulted here.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
mainentry (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.jsshim at the package root(fixes the filesystem probe — Step 1)
2. Add "./app.plugin" (no extension) to the exports map
(fixes the Node native resolver — Step 2)
Closes #159