Skip to content

Commit c563a09

Browse files
authored
fix: skip transforming react-native-web internals (#202)
1 parent 63242a0 commit c563a09

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
}
4949
},
5050
"./components/*": {
51-
"source": "./src/components/*.ts",
51+
"source": "./src/components/*.tsx",
5252
"react-native": "./src/components/*.tsx",
5353
"import": {
5454
"types": "./dist/typescript/module/src/components/*.d.ts",

src/metro/resolver.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function nativeResolver(
2626
const resolution = resolver(context, moduleName, platform);
2727
const isInternal = isFromThisModule(context.originModulePath);
2828
const isReactNativeIndex = context.originModulePath.endsWith(
29-
`react-native${sep}index.js`,
29+
`${sep}react-native${sep}index.js`,
3030
);
3131

3232
if (isInternal || resolution.type !== "sourceFile" || isReactNativeIndex) {
@@ -73,7 +73,9 @@ export function webResolver(
7373
// Only operate on source files
7474
resolution.type !== "sourceFile" ||
7575
// Skip anything that isn't importing from `react-native-web`
76-
!resolution.filePath.includes(`${sep}react-native-web${sep}`)
76+
!resolution.filePath.includes(`${sep}react-native-web${sep}`) ||
77+
// Skip internal react-native-web files
78+
resolution.filePath.includes(`${sep}react-native-web${sep}dist${sep}vendor`)
7779
) {
7880
return resolution;
7981
}
@@ -83,7 +85,12 @@ export function webResolver(
8385
const isIndex = segments.at(-1)?.startsWith("index.");
8486
const module = segments.at(-2);
8587

86-
if (!isIndex || !module || !allowedModules.has(module)) {
88+
if (
89+
!isIndex ||
90+
!module ||
91+
!allowedModules.has(module) ||
92+
module === "VirtualizedList"
93+
) {
8794
return resolution;
8895
}
8996

0 commit comments

Comments
 (0)