Skip to content

All imports are undefined in new metro config (react-native 0.72 and higher) #1544

Open

Description

@LueKedowsky

minimal-repro.zip

Bug Description

After upgrading from React Native 0.71 to 0.73, applications using module path aliases in Metro config crash with TypeError: Cannot read property 'rootReducer' of undefined when importing modules via configured aliases.

Steps to Reproduce

  1. Set up RN 0.73 project with Metro alias configuration:

    // metro.config.js
    alias: { src: path.resolve(__dirname, 'src') }
  2. Configure Babel module resolver:

    // .babelrc
    ["module-resolver", { "alias": { "src": "./src" } }]
  3. Import module using alias:

    // src/App.tsx
    import { rootReducer } from 'src/core/reducer';
  4. Run the app

Expected Behavior

App should start normally and import modules correctly via configured aliases.

Actual Behavior

App crashes with error:

TypeError: Cannot read property 'rootReducer' of undefined

Environment

  • React Native: 0.73.11
  • Metro: 0.73.5
  • Platform: Android/iOS
  • Previous working version: RN 0.71

Additional Context

The issue appears to be related to changes in Metro's module resolution in RN 0.73. The same configuration works fine in RN 0.71. Module imports using relative paths work correctly, only alias-based imports fail.

Reproduction

Minimal reproduction case attached in the linked repository.

Activity

  1. nemorize commented on Oct 8, 2025

    @nemorize

    same here. any updates?

  2. robhogan commented on Oct 8, 2025

    @robhogan
    Collaborator

    RN 0.73 is a long time out of support, folks - 0.82 was out today. Does anyone have a repro on a recent version?

  3. nemorize commented on Oct 9, 2025

    @nemorize

    In my case, it was not a metro issue.
    Some libraries (firebase etc.,) required modification of the native code, but I didn't, and I don't know what cause this was, but all the imports didn't work as normal.
    After modifying the native code as suggested by the library, the import started working normally.

  4. LueKedowsky commented on Oct 14, 2025

    @LueKedowsky
    Author

    In my case, it was not a metro issue. Some libraries (firebase etc.,) required modification of the native code, but I didn't, and I don't know what cause this was, but all the imports didn't work as normal. After modifying the native code as suggested by the library, the import started working normally.

    @nemorize , Can you give an example?

  5. LueKedowsky commented on Oct 14, 2025

    @LueKedowsky
    Author

    RN 0.73 is a long time out of support, folks - 0.82 was out today. Does anyone have a repro on a recent version?

    @robhogan same errors on v81

  6. VirtualDOMinic commented on Jan 7, 2026

    @VirtualDOMinic

    Did you make any progress with this @LueKedowsky ? Same problem with a move from 72 to 73 (yes 73 is out of support, but I'm handcuffed by what the business prioritises me spending my time on, and RN upgrades get pushed back in favour of new features 😵 )

    Also curious if @nemorize is able to expand more. Interesting that missing native changes could cause this

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