react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

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

Open jonthysell opened this issue 7 months ago • 3 comments

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

jonthysell avatar Apr 30 '25 21:04 jonthysell

This just started repro-ing in main today. I'm not 100% sure it's create-react-native-library's fault - CI ran fine in main today with create-react-native-library@0.49.8 and it worked fine. Now trying that version locally it fails.

Reverting all the way back to create-react-native-library@0.48.9 in PR #14631 worked to unblock us, but maybe because of some other updated dependency in the chain.

TLDR: 0.48.x works and 0.49.x doesn't, and the workaround may need to be applied to older stable branches to unblock them.

jonthysell avatar Apr 30 '25 21:04 jonthysell

Recommend next step is to iterate on RNW's metro.config and overrides to see what's colliding here.

chrisglein avatar May 01 '25 16:05 chrisglein

i want to work on this issue , i have been primary developer in a similar enterprise project and know my way around this

ChethanKottari avatar Jun 18 '25 03:06 ChethanKottari