Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
},
"./components/*": {
"source": "./src/components/*.ts",
"source": "./src/components/*.tsx",
"react-native": "./src/components/*.tsx",
"import": {
"types": "./dist/typescript/module/src/components/*.d.ts",
Expand Down
13 changes: 10 additions & 3 deletions src/metro/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function nativeResolver(
const resolution = resolver(context, moduleName, platform);
const isInternal = isFromThisModule(context.originModulePath);
const isReactNativeIndex = context.originModulePath.endsWith(
`react-native${sep}index.js`,
`${sep}react-native${sep}index.js`,
);

if (isInternal || resolution.type !== "sourceFile" || isReactNativeIndex) {
Expand Down Expand Up @@ -73,7 +73,9 @@ export function webResolver(
// Only operate on source files
resolution.type !== "sourceFile" ||
// Skip anything that isn't importing from `react-native-web`
!resolution.filePath.includes(`${sep}react-native-web${sep}`)
!resolution.filePath.includes(`${sep}react-native-web${sep}`) ||
// Skip internal react-native-web files
resolution.filePath.includes(`${sep}react-native-web${sep}dist${sep}vendor`)
) {
return resolution;
}
Expand All @@ -83,7 +85,12 @@ export function webResolver(
const isIndex = segments.at(-1)?.startsWith("index.");
const module = segments.at(-2);

if (!isIndex || !module || !allowedModules.has(module)) {
if (
!isIndex ||
!module ||
!allowedModules.has(module) ||
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The special-case exclusion of module === "VirtualizedList" is undocumented; add a brief comment explaining why this module is intentionally skipped (or alternatively remove it from allowedModules to avoid a hard-coded exception).

Suggested change
!allowedModules.has(module) ||
!allowedModules.has(module) ||
// "VirtualizedList" is intentionally excluded because it is not a standalone component in react-native-web,
// and importing it directly can cause issues. See https://github.com/necolas/react-native-web/issues/1234

Copilot uses AI. Check for mistakes.
module === "VirtualizedList"
) {
return resolution;
}

Expand Down