From bea524c3e9c411b0988754f7aed9927fc4c3535d Mon Sep 17 00:00:00 2001 From: Kallinikos Milonakis Date: Wed, 2 Sep 2026 13:42:25 +0300 Subject: [PATCH 1/2] fix(init): use posix separators for the paths written into package.json `bob init` builds the values for `main`, `module`, `types` and `exports` by interpolating `path.join` into a `./...` string. On Windows that yields backslashes, so a freshly initialised library gets: "main": "./lib\module\index.js", "exports": { ".": { "default": "./lib\module\index.js" } } Those fields are module specifiers rather than filesystem paths and are always forward-slashed, so the manifest is wrong and `exports` in particular will not resolve. Join them with `path.posix` instead. The committed snapshot in init.test.ts already encodes the correct forward-slash output and now matches on Windows without being regenerated. --- packages/react-native-builder-bob/src/init.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/react-native-builder-bob/src/init.ts b/packages/react-native-builder-bob/src/init.ts index fe363f78d..934698b72 100644 --- a/packages/react-native-builder-bob/src/init.ts +++ b/packages/react-native-builder-bob/src/init.ts @@ -149,6 +149,9 @@ export async function init() { ? targets[0] : undefined; + // These end up in `main`, `module`, `types` and `exports` in package.json, + // which are specifiers rather than filesystem paths and always use forward + // slashes, so they are joined with `path.posix` regardless of platform. const entries: { [key in 'commonjs' | 'module']?: string; } = {}; @@ -157,11 +160,11 @@ export async function init() { if (targets.includes('module')) { esm = true; - entries.module = `./${path.join(output, 'module', 'index.js')}`; + entries.module = `./${path.posix.join(output, 'module', 'index.js')}`; } if (targets.includes('commonjs')) { - entries.commonjs = `./${path.join(output, 'commonjs', 'index.js')}`; + entries.commonjs = `./${path.posix.join(output, 'commonjs', 'index.js')}`; } const types: { @@ -170,7 +173,7 @@ export async function init() { if (targets.includes('typescript')) { if (targets.includes('commonjs') && targets.includes('module')) { - types.require = `./${path.join( + types.require = `./${path.posix.join( output, 'typescript', 'commonjs', @@ -178,7 +181,7 @@ export async function init() { 'index.d.ts' )}`; - types.import = `./${path.join( + types.import = `./${path.posix.join( output, 'typescript', 'module', @@ -186,7 +189,7 @@ export async function init() { 'index.d.ts' )}`; } else { - types.require = `./${path.join( + types.require = `./${path.posix.join( output, 'typescript', source, From 57b458edb416efc2cfb22f8636016297d566f994 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Tue, 8 Sep 2026 11:33:29 +0200 Subject: [PATCH 2/2] ci: run unit tests on windows --- .github/workflows/check-project.yml | 18 +++++++++++++++--- packages/react-native-builder-bob/src/init.ts | 3 --- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-project.yml b/.github/workflows/check-project.yml index 7e7d2d08b..e4c44ac32 100644 --- a/.github/workflows/check-project.yml +++ b/.github/workflows/check-project.yml @@ -28,8 +28,20 @@ jobs: - name: Typecheck run: yarn typecheck - - name: Test - run: yarn test - - name: Build packages run: yarn lerna run prepare + + test: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Setup + uses: ./.github/actions/setup + + - name: Test + run: yarn test diff --git a/packages/react-native-builder-bob/src/init.ts b/packages/react-native-builder-bob/src/init.ts index 934698b72..434eef924 100644 --- a/packages/react-native-builder-bob/src/init.ts +++ b/packages/react-native-builder-bob/src/init.ts @@ -149,9 +149,6 @@ export async function init() { ? targets[0] : undefined; - // These end up in `main`, `module`, `types` and `exports` in package.json, - // which are specifiers rather than filesystem paths and always use forward - // slashes, so they are joined with `path.posix` regardless of platform. const entries: { [key in 'commonjs' | 'module']?: string; } = {};