From 32455727f0ef5089e369a0de7d465c4811ecf8bc Mon Sep 17 00:00:00 2001 From: Okiki Ojo Date: Thu, 12 Feb 2026 17:01:59 -0500 Subject: [PATCH] feat: enhance extension probing logic to support suffix-style specifiers in VFS resolution Signed-off-by: Okiki Ojo --- core/plugins/fs.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/plugins/fs.ts b/core/plugins/fs.ts index 8791c44..44f1f53 100644 --- a/core/plugins/fs.ts +++ b/core/plugins/fs.ts @@ -53,8 +53,20 @@ export async function resolveVfsPath( if (await fileExists(fs, candidate)) return candidate; - // 2) Extension probing for extensionless imports. - if (extname(candidate).length === 0) { + // 2) Extension probing. + // + // Historically this only probed truly extensionless imports (e.g. "./foo" + // -> "./foo.ts"). In practice, many packages (Expo / RN ecosystem) also use + // suffix-style specifiers such as "./Expo.fx" and "./uuid.types" where the + // real files are "./Expo.fx.ts" and "./uuid.types.ts". + // + // So we probe whenever the current extension is NOT already one of the known + // resolve extensions. This preserves normal behavior for "./foo.ts" while + // enabling suffix-style resolution. + const candidateExt = extname(candidate); + const hasKnownResolvableExt = resolveExtensions.includes(candidateExt); + + if (!hasKnownResolvableExt) { for (const ext of resolveExtensions) { const withExt = candidate + ext; if (await fileExists(fs, withExt)) -- 2.51.2