Skip to content

fix(compile): check nodePaths directly instead of require.resolve#66

Merged
Kikobeats merged 1 commit into
masterfrom
next
May 22, 2026
Merged

fix(compile): check nodePaths directly instead of require.resolve#66
Kikobeats merged 1 commit into
masterfrom
next

Conversation

@Kikobeats
Copy link
Copy Markdown
Owner

@Kikobeats Kikobeats commented May 22, 2026

require.resolve({ paths }) walks up parent directories, finding packages in ancestor node_modules that esbuild's nodePaths cannot reach. This skipped installs for deps like cheerio, causing "Could not resolve" build failures in production.


Note

Medium Risk
Changes dependency-install skipping logic based on direct filesystem checks in nodePaths, which can affect whether packages are installed or reused and may impact build reliability in environments with custom module layouts.

Overview
Fixes dependency detection when nodePaths are provided by checking for package.json directly under each configured nodePaths entry instead of using require.resolve({ paths }), preventing false positives from ancestor node_modules traversal that esbuild won’t honor.

Adds a regression test that simulates a deep nodePaths directory with a conflicting parent node_modules, ensuring missing deps are installed into tmpdir rather than incorrectly skipped.

Reviewed by Cursor Bugbot for commit e43cb84. Bugbot is set up for automated code reviews on this repo. Configure here.

require.resolve({ paths }) walks up parent directories, finding
packages in ancestor node_modules that esbuild's nodePaths cannot
reach. This skipped installs for deps like cheerio, causing
"Could not resolve" build failures in production.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coveralls
Copy link
Copy Markdown

coveralls commented May 22, 2026

Coverage Report for CI Build 26303777067

Warning

No base build found for commit 683e33c on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 95.215%

Details

  • Patch coverage: 1 uncovered change across 1 file (6 of 7 lines covered, 85.71%).

Uncovered Changes

File Changed Covered %
src/compile/index.js 7 6 85.71%

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 695
Covered Lines: 666
Line Coverage: 95.83%
Relevant Branches: 120
Covered Branches: 110
Branch Coverage: 91.67%
Branches in Coverage %: Yes
Coverage Strength: 46.57 hits per line

💛 - Coveralls

@Kikobeats Kikobeats merged commit 9e16358 into master May 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants