Skip to content

Building Expo App locally Fails: envs are not defined in local build process.  #487

Open
@AyoCodess

Description

@AyoCodess
  • Asked question in discussions
  • Tried the troubleshooting Wiki
  • Followed the migration Wiki
  • Installed library as devDependency not production dependency

Describe the bug
envs are not defined in local build process.

To Reproduce
Steps to reproduce the behavior:
local builds

Expected behavior
env should be loaded into build process

Screenshots
Screenshot 2024-02-17 at 09 41 38
edit: (IM USING EXPO_PUBLIC_)

Desktop (please complete the following information):
Mac book pro

Additional context
My app picks up the envs while developing just fine. it only failed when i build the app.

am i missing something in my set up?

module.exports = function (api) {
  api.cache(false)

  return {
    presets: [
      ['babel-preset-expo',{ jsxImportSource: 'nativewind' }],
      'nativewind/babel'
    ],
    plugins: [
      ['react-native-reanimated/plugin'],
      [
        'module:react-native-dotenv',
        {
          envName: 'APP_ENV',
          moduleName: "@env",
          path: ".env",
          allowUndefined: false,
          safe: true,
          verbose: false
        }
      ]
    ]
  };
};
declare module '@env' {
  export const EXPO_PUBLIC_CONVEX_URL: string;
  export const EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: string;
  export const EXPO_PUBLIC_SECRET: string;
  export const EXPO_PUBLIC_SERVER_URL: string;
  export const EXPO_PUBLIC_E_LIST: string;
}

works as expected during development.

import { EXPO_PUBLIC_CONVEX_URL, EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY } from "@env";

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions