deno
591ff87f - fix(compile): resolve bare npm imports in --bundle worker sources (#34967)

Commit
51 days ago
fix(compile): resolve bare npm imports in --bundle worker sources (#34967) deno compile --bundle follows new Worker(new URL(...)) references and pulls the referenced modules into the bundle graph. When the entrypoint lives in a subdirectory with its own package scope (for example a dist/ build output with its own package.json) and a worker is authored in a sibling source tree, a bare npm import from that worker source failed to resolve with "Import X not a dependency", even though the package is declared, installed, and resolves fine from the entrypoint's own tree in the same build. Plain deno bundle was unaffected because it does not follow those worker references into the source tree. The package is already present in the build's resolved npm snapshot, so this falls back to resolving such bare specifiers against that snapshot by package name, the way Node and Bun locate a package in a reachable node_modules. The fallback only runs after normal resolution has already failed, so successful resolutions and plain deno bundle behavior are unchanged. Closes #34937
Author
Parents
Loading