Vscode-js-debug: Start project with a relative path

Created on 22 Jun 2020  路  1Comment  路  Source: microsoft/vscode-js-debug

This could, probably, regarded as a feature wish. However, it may be rather important (see below).

Given the following launch configuration.

{
  "console": "integratedTerminal",
  "disableOptimisticBPs": true,
  "envFile": "${workspaceFolder}/.vscode/.env",
  "name": "Debug",
  "request": "launch",
  "stopOnEntry": true,
  "program": "${workspaceFolder}/server/startup",
  "skipFiles": ["<node_internals>/**/*.js"],
  "type": "node"
}

I'm working on Windows with Cmd or Powershell terminal.

The old debugger starts the project like
cd <path to workspace> && cmd /C "<set environment variables>" && <path to node.exe> server\startup.js "
ie, it makes a relative path from the "program" setting (which is and must be absolute).

With the new debugger, however, in the last part, it uses the absolute path:
... && <path to node.exe> <path to workspace>\server\startup "

Unfortunately, <path to workspace> is built with a lower case drive letter. This may lead to problems, when node uses require to load modules, which seems to use uppercase drive letters. graphql, for instance, may refuse to run because it supposes there are two different instances (lower case and upper case drive letter).

So it looks like there is a "simple" solution, when the project is called with a relative path like it is with the older debugger.

bug verified

Most helpful comment

This may lead to problems, when node uses require to load modules, which seems to use uppercase drive letters. graphql, for instance, may refuse to run because it supposes there are two different instances (lower case and upper case drive letter).

I'm kind of dubious about this: windows paths, including the drive letter, are case-insensitive by default. Node.js for example seems equally happen to load require('E:/vscode/package.json') or require('e:/vscode/package.json'). It is probably a bug if a system treats the path in a case-sensitive fashion.

Regardless, fixed to make it relative to the cwd

>All comments

This may lead to problems, when node uses require to load modules, which seems to use uppercase drive letters. graphql, for instance, may refuse to run because it supposes there are two different instances (lower case and upper case drive letter).

I'm kind of dubious about this: windows paths, including the drive letter, are case-insensitive by default. Node.js for example seems equally happen to load require('E:/vscode/package.json') or require('e:/vscode/package.json'). It is probably a bug if a system treats the path in a case-sensitive fashion.

Regardless, fixed to make it relative to the cwd

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelhyman picture michaelhyman  路  5Comments

eamodio picture eamodio  路  5Comments

KieranHarper picture KieranHarper  路  5Comments

roblourens picture roblourens  路  5Comments

thomasrea0113 picture thomasrea0113  路  6Comments