Skip to content

Commit 6e6ab63

Browse files
committed
feat: add package.json to exports with bob init if includesGeneratedCode is falsy
1 parent 09076cc commit 6e6ab63

File tree

1 file changed

+8
-3
lines changed
  • packages/react-native-builder-bob/src

1 file changed

+8
-3
lines changed

packages/react-native-builder-bob/src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ yargs
282282
if (esm) {
283283
let replace = false;
284284

285-
const exports = {
285+
const exportsField = {
286286
'.': {
287287
import: {
288288
...(types.import ? { types: types.import } : null),
@@ -295,9 +295,14 @@ yargs
295295
},
296296
};
297297

298+
if (pkg.codegenConfig && !pkg.codegenConfig.includesGeneratedCode) {
299+
// @ts-expect-error The exports is not strictly types therefore it doesn't know about the package.json property
300+
exportsField['./package.json'] = './package.json';
301+
}
302+
298303
if (
299304
pkg.exports &&
300-
JSON.stringify(pkg.exports) !== JSON.stringify(exports)
305+
JSON.stringify(pkg.exports) !== JSON.stringify(exportsField)
301306
) {
302307
replace = (
303308
await prompts({
@@ -312,7 +317,7 @@ yargs
312317
}
313318

314319
if (replace) {
315-
pkg.exports = exports;
320+
pkg.exports = exportsField;
316321
}
317322
}
318323

0 commit comments

Comments
 (0)