[metro-file-map] On Windows, a relative symlink on another drive than the project resolves under the project's drive, so modules behind it are not found
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
- Área
- build-system, tooling
Línea de trabajo
Start with packages/metro-file-map/src/lib/RootPathUtils.js, especially resolveSymlinkToNormal, and follow how it resolves a relative symlink whose target is on another drive. Run the linked reproduction with the project and store on separate drives; done means npm run bundle writes bundle.js and the resolved module path is on the store's drive.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Reproduction: https://github.com/YevheniiKotyrlo/metro-file-map-cross-drive-relative-symlink
On Windows, when the project root is on one drive and a watched folder is on another, a relative symlink inside the watched folder resolves to a path under the project's drive (C:\D:\… or D:\C:\…), so every module reached through it fails to resolve. Bun's isolated installs and pnpm lay node_modules out with exactly these relative links, so a project on one drive whose store or monorepo root is on another cannot bundle.
Steps (metro 0.87.2, and metro-file-map built from main at fcced577ad7b1ce8f24a891537f48d326b3a2796; Node 26.12.1, npm 12.2.1, Windows 11):
- Clone the reproduction onto one drive and
npm install. It is a plain Metro project whoseindex.jsrequiresgreeting, and whosemetro.config.jswatches the store'snode_modules. node make-store.js C:\Temp\store, a new folder on the other drive. It lays outgreetingandpunctuationthe way Bun's isolated installs do,greeting's dependency onpunctuationbeing the relative symlink..\..\[email protected]\node_modules\punctuation, and links the project'snode_modules/greetinginto the store.npm run bundle, which runsmetro build index.js --platform android --out bundle.js.
For main: between steps 1 and 2, yarn install --frozen-lockfile and node scripts/build.js in a react/metro checkout, then node use-metro-main.js <the checkout>, which puts its packages/metro-file-map/build in place of the installed metro-file-map/src.
Expected: bundle.js is written.
Seen, on 0.87.2 and on main alike:
Error: Unable to resolve module punctuation from C:\Temp\metro-store-main-1793405179\node_modules\.store\[email protected]\node_modules\greeting\index.js: punctuation could not be found within the project or in these directories:
With the store on the project's drive (node make-store.js D:\Temp\store in a fresh clone), the same build on main writes bundle.js.
RootPathUtils.resolveSymlinkToNormal (packages/metro-file-map/src/lib/RootPathUtils.js, line 190) resolves the target with path.resolve(this.#rootDir, symlinkNormalPath, '..', readlinkResult). For a symlink on another drive, symlinkNormalPath is the cross-drive normal form, one more .. than the root is deep followed by the drive (..\..\..\..\D:\store\…), which normalToAbsolute understands but path.resolve does not: it clamps the last .. at C:\, giving C:\D:\store\…. With the project root at C:\Users\someone\project:
const utils = new RootPathUtils('C:\\Users\\someone\\project');
const symlink = utils.absoluteToNormal('D:\\store\\node_modules\\.bun\\[email protected]\\node_modules\\invariant');
utils.normalToAbsolute(utils.resolveSymlinkToNormal(symlink, '..\\..\\[email protected]\\node_modules\\invariant'));
// 'C:\\D:\\store\\node_modules\\.bun\\[email protected]\\node_modules\\invariant'
Resolving from this.normalToAbsolute(symlinkNormalPath) instead of joining the normal path onto the root gives D:\store\node_modules\.bun\[email protected]\node_modules\invariant. #1696 makes normalToAbsolute return an absolute normal path as it is, which does not reach this case, since the stored normal path is relative.
- Lenguaje dominante
- JavaScript
- Estrellas
- 5.7k
- Forks
- 711
- Merge medio
- 2 d 22 h
- PR fusionados (30 d)
- 72
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de react/metro
-
[metro-file-map] An error a watcher backend reports ends the server, since nothing listens for itPosiblemente ocupada @sorinc03 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
react/metro#2143 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
react/metro#2153 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
metro-file-map gives up on a fallback watcher that is still starting after a fixed 240 s, and leaves it runningPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
Published declarations import types from connect, @babel/core and @babel/traverse, whose @types packages are not dependenciesPosiblemente ocupada @sorinc03 la tomó hoy. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
Todos los issues de react/metro
Issues similares
-
ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
LucasSantana-Dev/Lucky#2945 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
brijeshb42/monaco-vim#175 ·
-
good first issue
Dificultad 2/5 3-5 días Aptitud para principiantes 62/100
paipai1999/POS-system#3 ·
-
good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
r-afael/better-yt-recommendations#36 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
microsoft/playwright#43875 · 1 comentario ·
Los mantenedores suelen responder en 1 día