Open mrevanzak opened 4 days ago
Yes, technically you can add the environment setup to any project that uses the Expo prebuild system. Here is an explanation of the problem you are experiencing:
"Unable to resolve module path" means you are trying to import the path
Node.js module into your app, which will not work because the runtime is different. This issue arises because you are importing the ./env.js
file into a file located in the ./src
folder, which Metro is attempting to bundle.
To resolve this, ensure you import your environment variables from @env
, which should be an alias for ./src/core/env.js
, instead of ./env.js
.
let's me know if the issue still persist after those checks
i already make sure bunch of time if it was correct. i also tried to not use the alias but still no luck
Make sure you are starting the metro server without cache pnpm start -c
Summary:
I have an existing app that already running and i wanna replicate how this template manages the env. but i cant get it running. always fails on
Unable to resolve module path
. if i installed 'path' as dev deps it will shows another error because of dotenv doesnt work for react native (?)Steps to reproduce:
ran the build:staging script
Expected behavior:
successfully build and running
Additional notes:
Tasks