microsoft / microsoft/react-native-windows

New libs created with create-react-native-library > 0.48.9 have a new metro config that we don't support

Open
#14,634 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Extensions External help wanted New Architecture Workstream: Module Support
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

As part of our init-windows script, when applied to a library, we also add windows to any example app present. We mostly use what we're given, but we specifically override the given metro.config.js (as all RN apps, it doesn't work with windows out of the box).

Specifically for library example apps (which need to access the library) we incorporate the upstream changes present in create-react-native-library's metro config.

Starting with create-react-native-library@^0.49.0 however, they've completely refactored their metro config into some separate packages, and our version doesn't work anymore. Specicially, during bundling, you'll get an error that it can't find the library package anymore.

We'll need to figure out how to reconcile the differences.

Steps To Reproduce
  1. Create a new library with create-react-native-library@latest
  2. Add windows with init-windows
  3. Attempt to run the the example app with run-windows
Expected Results

The app runs

CLI version

15.0.0-alpha.2

Environment
info Fetching system and libraries information...
System:
  OS: Windows 11 10.0.26100
  CPU: "(24) x64 AMD Ryzen Threadripper PRO 3945WX 12-Cores     "
  Memory: 38.60 GB / 63.86 GB
Binaries:
  Node:
    version: 18.18.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 3.6.1
    path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm:
    version: 9.8.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions:
      - 10.0.19041.0
      - 10.0.22621.0
      - 10.0.26100.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.14.35906.104 (Visual Studio Enterprise 2022)
    - 17.13.35931.197 (Visual Studio Enterprise 2022)
Languages:
  Java: Not Found
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0-alpha.2
    wanted: 15.0.0-alpha.2
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.78.0-nightly-20250113-d4407d6f7
    wanted: 0.78.0-nightly-20250113-d4407d6f7
  react-native-windows:
    installed: 0.0.0-canary.949
    wanted: 0.0.0-canary.949
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Community Modules

No response

Target Platform Version

10.0.22621

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

ReleaseBundle

Snack, code example, screenshot, or link to a repository

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a library generated by create-react-native-library@latest, then compare its metro.config.js with the override applied by init-windows. Trace library resolution during run-windows bundling and reconcile the configurations so the example app runs successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.