Skip to content

Static assets fail to load in monorepo since 0.81 #3909

@Aure77

Description

@Aure77

What happened?

Since I upgrade to RN 0.81, images (assets) are not loaded in dev (with metro server).
I think there is a issue with monorepo settings (enhanceMiddleware) with RN 0.81+

Affected Package

@rnx-kit/metro-config

Version

2.2.1

Which platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows

System Information

System:
  OS: macOS 15.6
  CPU: (8) arm64 Apple M1
  Memory: 254.28 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.0
    path: /private/var/folders/8k/qyy417_57vb1nd1p1985ggdr0000gp/T/xfs-632f35ae/node
  Yarn:
    version: 4.6.0
    path: /private/var/folders/8k/qyy417_57vb1nd1p1985ggdr0000gp/T/xfs-632f35ae/yarn
  npm:
    version: 10.8.2
    path: ~/.local/share/mise/installs/node/20.19.0/bin/npm
  Watchman:
    version: 2025.11.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/a389216/.gem/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK:
    API Levels:
      - "23"
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
      - "36"
      - "36"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 32.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
      - 35.0.0
      - 35.0.1
      - 36.0.0
      - 36.1.0
    System Images:
      - android-24 | Google APIs ARM 64 v8a
      - android-30 | Wear OS 3 ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
      - android-36.1 | Pre-Release 16 KB Page Size Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.2 AI-252.27397.103.2522.14514259
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /Users/a389216/.local/share/mise/installs/java/zulu-17.54.21/bin/javac
  Ruby:
    version: 3.4.4
    path: /Users/a389216/.local/share/mise/installs/ruby/3.4.4/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to Reproduce

Use default metro-config settings in a monorepo with RN 0.81+:

const { makeMetroConfig } = require("@rnx-kit/metro-config");

module.exports = makeMetroConfig({});

Fail silently, image are not loaded:
Image
(close image is not loaded for ex)

I mitigated issue on Android by overriding/remove enhanceMiddleware:

const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, "../..");

module.exports = makeMetroConfig({
  server: {
    enhanceMiddleware: null, // override @rnx-kit/metro-config middleware (bug since RN 0.81+ ?)
  },
  projectRoot,
  watchFolders: [
    workspaceRoot
  ],
});

But path with ".." doesn't works with iOS. So monorepo support doesn't works anymore with @rnx-kit/metro-config

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions