app.plugin.js requires @expo/config-plugins but it's only in devDepen…#442
Open
ottob wants to merge 1 commit into
Open
app.plugin.js requires @expo/config-plugins but it's only in devDepen…#442ottob wants to merge 1 commit into
ottob wants to merge 1 commit into
Conversation
…dencies
this breaks isolated installs and Expo prebuild under pnpm / Bun globalStore
@intercom/intercom-react-native@10.0.1 ships app.plugin.js (the Expo config plugin entry) which loads lib/commonjs/expo-plugins/index.js. That file does:
const { withPlugins, ... } = require('@expo/config-plugins');
But @expo/config-plugins is declared only under devDependencies in package.json. With hoisted installs it works by accident - @expo/config-plugins happens to be hoisted from expo to the project root. Under isolated layouts (pnpm strict, Yarn PnP, Bun globalStore = true) the package can only resolve its declared runtime deps, so it crashes:
PluginError: Cannot find module '@expo/config-plugins'
Require stack:
- <store>/@intercom+intercom-react-native@10.0.1/.../lib/commonjs/expo-plugins/index.js
- <store>/@intercom+intercom-react-native@10.0.1/.../app.plugin.js
- ...
Repro
- Expo 56 app with @intercom/intercom-react-native installed.
- bun install with bunfig.toml containing globalStore = true, then bun expo start (or expo prebuild).
- Crashes when Expo loads the plugin.
Suggested fix
Move @expo/config-plugins to peerDependencies (optional, since bare RN consumers don't need it):
"peerDependencies": {
"@expo/config-plugins": "*",
"react": "*",
"react-native": "*"
},
"peerDependenciesMeta": {
"@expo/config-plugins": { "optional": true }
}
@expo/config-plugins is bundled with expo, so any Expo consumer already has a usable instance - peerDep is the correct contract.
Environment
- @intercom/intercom-react-native 10.0.1
- expo 56.0.5, @expo/config-plugins (bundled via expo)
- bun 1.3.14 with globalStore = true
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.
…dencies
this breaks isolated installs and Expo prebuild under pnpm / Bun globalStore
@intercom/intercom-react-native@10.0.1 ships app.plugin.js (the Expo config plugin entry) which loads lib/commonjs/expo-plugins/index.js. That file does:
const { withPlugins, ... } = require('@expo/config-plugins');
But @expo/config-plugins is declared only under devDependencies in package.json. With hoisted installs it works by accident - @expo/config-plugins happens to be hoisted from expo to the project root. Under isolated layouts (pnpm strict, Yarn PnP, Bun globalStore = true) the package can only resolve its declared runtime deps, so it crashes:
PluginError: Cannot find module '@expo/config-plugins'
Require stack:
Repro
Suggested fix
Move @expo/config-plugins to peerDependencies (optional, since bare RN consumers don't need it):
"peerDependencies": {
"@expo/config-plugins": "", "react": "", "react-native": "*" }, "peerDependenciesMeta": { "@expo/config-plugins": { "optional": true } }
@expo/config-plugins is bundled with expo, so any Expo consumer already has a usable instance - peerDep is the correct contract.
Environment