microsoft / microsoft/vscode-js-debug-browsers

Unable to find browser on Mac due to syntax issue

Open
#19 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5
Forks
6
Avg merge
2d 6h
Merged PRs (30d)
2

Description

I am reusing code in the package and ran into a weird error

Error: Cannot access 'execa' before initialization

Stack:
    ReferenceError: Cannot access 'execa' before initialization
        at new DarwinFinderBase (/path/node_modules/@vscode/js-debug-browsers/dist/darwinFinderBase.js:15:64)

And indeed, in the dist version does not have execa defined:

https://unpkg.com/browse/@vscode/js-debug-browsers@1.1.2/dist/darwinFinderBase.js

The reason is that here

https://github.com/microsoft/vscode-js-debug-browsers/blob/b2ef948575e8d1e3a28dbedbbbfaac22076ae13c/src/darwinFinderBase.ts#L34

the default value is the same as the parameter name, and that does not work. The import is only used as type, so it is removed after TypeScript transpilation. No idea why this was not flagged -- possibly because this uses an old TypeScript version 4.5.4

A simple fix is to just replace execa with _execa as the default value -- literally a one character change.

But I guess additional work could be done to polish up the codebase a bit, including update TypeScript version.

Thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open src/darwinFinderBase.ts around line 34 and inspect the default parameter and its execa import. Confirm the generated dist/darwinFinderBase.js no longer fails with the reported initialization error, and verify browser discovery works for the affected Mac path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.