Skip to content

Commit a260218

Browse files
authored
fix: use react native babel config for node_modules (#823)
This uses the react native babel preset for compiling `node_modules` - mainly useful for tests, so that syntaxes such as Flow are handled. Related to ##747
1 parent 7dc0af2 commit a260218

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

packages/create-react-native-library/src/exampleApp/dependencies.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ export async function alignDependencyVersionsWithExampleApp(
1616
path.join(folder, 'example', 'package.json')
1717
);
1818

19-
const PACKAGES_TO_COPY = ['react', 'react-native', '@types/react'];
19+
const PACKAGES_TO_COPY = [
20+
'react',
21+
'react-native',
22+
'@types/react',
23+
'@react-native/babel-preset',
24+
];
2025

2126
if (
2227
config.example === 'vanilla' &&

packages/create-react-native-library/templates/common/$package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"@react-native-community/cli": "15.0.0-alpha.2",
8181
<% } -%>
8282
"@react-native/eslint-config": "^0.78.0",
83+
"@react-native/babel-preset": "0.78.2",
8384
"@release-it/conventional-changelog": "^9.0.2",
8485
"@types/jest": "^29.5.5",
8586
"@types/react": "^19.0.12",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
module.exports = {
22
presets: ['module:react-native-builder-bob/babel-preset'],
3+
overrides: [
4+
{
5+
include: /\/node_modules\//,
6+
presets: ['module:@react-native/babel-preset'],
7+
},
8+
],
39
};

0 commit comments

Comments
 (0)