deno
5ff8b7ea - fix(compile): embed workspace package.json files in the VFS (#34530)

Commit
56 days ago
fix(compile): embed workspace package.json files in the VFS (#34530) Compiling a project that imports a non-Deno workspace member by its package name, where the member is described by a package.json with an "exports" map, produced a binary that failed at runtime with ERR_MODULE_NOT_FOUND. Instead of honoring the exports target it resolved the bare "<dir>/index.js", because the workspace package.json files were only embedded into the virtual filesystem for the byonm npm resolver. With a managed resolver (for example "nodeModulesDir": "auto"), or with no npm packages at all, the file was missing from the VFS, so the runtime node resolver could not read the exports field and fell back to legacy index.js resolution. This embeds the workspace package.json files unconditionally, before the npm resolver branch runs, so the exports map is available at runtime regardless of npm mode. This covers exports maps that point at either a built .js file or a .ts source file, and members that are themselves package.json packages. The runtime type-checking gap for these members (TS2307) is a separate resolver issue and is left for a follow-up; the spec tests use --no-check to isolate the runtime resolution behavior. Fixes #28926 Fixes #27315
Author
Parents
Loading