Skip to content

JEST_WORKER_ID leaks into Metro bundle #574

Closed

Description

@fordat

Problem

When building a production bundle, jest-worker unconditionally sets JEST_WORKER_ID on every worker process it spawns, even EAS builds when no tests are involved.

react-native-dotenv's Babel plugin runs inside those Metro transform workers and inlines variables from process.env into the bundle — including JEST_WORKER_ID, which is not declared in any .env file but is present in the worker's environment because jest-worker set it.

Impact

The result is a production app bundle with JEST_WORKER_ID as a non-null string. JEST_WORKER_ID now appears in third-party library code, in my case react-native-mmkv, which causes problems with that package (permanently sets it in test mode).

Issues with this have been raised in react-native-mmkv but I believe this problem belongs to react-native-dotenv.

Activity

  1. github-actions commented on Jun 1, 2026

    @github-actions

    Hey, thank you for opening this issue! 🙂 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/574

  2. added a commit that references this issue on Jun 29, 2026
    f3866b4
  3. goatandsheep commented on Jul 21, 2026

    @goatandsheep
    Collaborator

    hi did you try using blocklist?

  4. motdotla commented on Jul 28, 2026

    @motdotla
    Collaborator

    Fix here.

    #592

    will go out in next major release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions