From 5a2f31571556057e6479207f4c0aec8ec38c44fa Mon Sep 17 00:00:00 2001 From: Matt Champagne Date: Fri, 28 Nov 2025 23:09:17 -0500 Subject: [PATCH 1/2] fix: resolve symlinks when finding platform binaries This fixes an issue where the extension fails to find ReScript platform binaries (like bsc.exe) when using package managers that use symlinked node_modules structures, such as Deno and pnpm. The issue occurs because `path.join(rescriptDir, "..")` performs string manipulation rather than following the symlink. When `node_modules/rescript` is a symlink (e.g., to `.deno/rescript@12.0.0/node_modules/rescript`), the parent directory resolves to `node_modules/` instead of the actual parent where `@rescript/darwin-arm64` etc. are located. Using `fs.realpathSync()` to resolve the symlink first ensures the correct parent directory is found. --- server/src/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/utils.ts b/server/src/utils.ts index 9446585cd..09134571f 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -145,8 +145,10 @@ let findBinary = async ( // TODO: export `binPaths` from `rescript` package so that we don't need to // copy the logic for figuring out `target`. const target = `${process.platform}-${process.arch}`; + // Use realpathSync to resolve symlinks, which is necessary for package + // managers like Deno and pnpm that use symlinked node_modules structures. const targetPackagePath = path.join( - rescriptDir, + fs.realpathSync(rescriptDir), "..", `@rescript/${target}/bin.js`, ); From fbbdd8e0685514443527555e456b9b098276213c Mon Sep 17 00:00:00 2001 From: nojaf Date: Sun, 30 Nov 2025 11:26:54 +0100 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54407d177..11efe49d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ > - :house: [Internal] > - :nail_care: [Polish] +## [Unreleased] + +#### :nail_care: Polish + +- Resolve symlinks when finding platform binaries. https://github.com/rescript-lang/rescript-vscode/pull/1154 + ## 1.70.0 #### :bug: Bug fix