You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
The project root is currently being passed with REACT_NATIVE_APP_ROOT. This does not seem to work.
When I check the args arriving in react-native (node_modules/.github.com/expo/react-native/archive/sdk-31.0.0.tar.gz/react@16.5.0/node_modules/react-native/local-cli/server/runServer.js), the projectRoot is being set to a default value (See node_modules/.github.com/expo/react-native/archive/sdk-31.0.0.tar.gz/react@16.5.0/node_modules/react-native/local-cli/server/server.js).
Using app.json#packagerOpts = {projectRoot: 'something'} sets it using cli args which works.
It could be some other config option overriding it.
The bug may not have been picked up because react-native's default project root worked for most projects.
In my case, it is setting it to /xxx/node_modules/.github.com/expo/react-native/archive/sdk-31.0.0.tar.gz/react@16.5.0 by default, which then prevents the entry point being resolved correctly. I am using pnpm and a monorepo setup, so this is why it was probably not noticed. Below is the logic which set it:
function getProjectRoot() {
if (
__dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli[\/\\]util$/)
) {
// Packager is running from node_modules.
// This is the default case for all projects created using 'react-native init'.
return path.resolve(__dirname, '../../../..');
} else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) {
// React Native was installed using CocoaPods.
return path.resolve(__dirname, '../../../..');
}
return path.resolve(__dirname, '../..');
}
Description
packages/xdl/Project.js
The project root is currently being passed with
REACT_NATIVE_APP_ROOT
. This does not seem to work.When I check the
args
arriving inreact-native
(node_modules/.github.com/expo/react-native/archive/sdk-31.0.0.tar.gz/react@16.5.0/node_modules/react-native/local-cli/server/runServer.js
), theprojectRoot
is being set to a default value (Seenode_modules/.github.com/expo/react-native/archive/sdk-31.0.0.tar.gz/react@16.5.0/node_modules/react-native/local-cli/server/server.js
).Using
app.json#packagerOpts = {projectRoot: 'something'}
sets it using cli args which works.It could be some other config option overriding it.
The bug may not have been picked up because react-native's default project root worked for most projects.
In my case, it is setting it to
/xxx/node_modules/.github.com/expo/react-native/archive/sdk-31.0.0.tar.gz/react@16.5.0
by default, which then prevents the entry point being resolved correctly. I am using pnpm and a monorepo setup, so this is why it was probably not noticed. Below is the logic which set it:/xxx/node_modules/.github.com/expo/react-native/archive/sdk-31.0.0.tar.gz/react@16.5.0/node_modules/react-native/local-cli/util/Config.js
I have opened a bug in react-native but I doubt it will get fixed facebook/react-native#22623.
I only found one usage of
REACT_NATIVE_APP_ROOT
inreact-native
:Expected Behavior
Observed Behavior
Environment
Also specify:
Reproducible Demo
Please provide a minimized reproducible demonstration of the problem you're reporting.
Issues that come with minimal repro's are resolved much more quickly than issues where a maintainer has to reproduce themselves.
The text was updated successfully, but these errors were encountered: