Fix Windows ESM loader protocol issue in CLI#135
Conversation
On Windows, Node.js ESM loader expects absolute file paths to be valid file:// URLs, otherwise it throws a protocol error (e.g., 'Received protocol c:'). This change converts all dynamically imported absolute filesystem paths in the CLI to valid file:// URLs using node's built-in `pathToFileURL`. Co-authored-by: athal7 <467872+athal7@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe CLI now converts local filesystem paths to ChangesESM import URL handling
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This PR fixes an ESM loader protocol issue encountered on Windows machines. Specifically, when starting or running CLI commands, Node.js throws an error because dynamic dynamic imports (
import()) with absolute filesystem paths (likeC:\...) are treated as having ac:protocol. We resolve this by converting the absolute paths into validfile://URLs usingpathToFileURL(absolutePath).hrefbefore passing them to the dynamicimport()call.Fixes #118
PR created automatically by Jules for task 4380419992592494834 started by @athal7
Summary by CodeRabbit