Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Support file URLs for --experimental-modules #157

Closed
roblourens opened this issue Dec 9, 2017 · 5 comments
Closed

Support file URLs for --experimental-modules #157

roblourens opened this issue Dec 9, 2017 · 5 comments
Assignees
Milestone

Comments

@roblourens
Copy link
Member

When running Node with the --experimental-modules flag, it returns file paths as file URLs, not paths. We need to handle both formats.

We can set breakpoints without the file: prefix, because the regex still matches the rest. On Windows, slashes would have to changed to forward slashes.

@jpike88
Copy link

jpike88 commented Mar 15, 2018

@roblourens just confirming that you think microsoft/vscode#45750 is directly related to this issue? It seems the case but just want your opinion

@roblourens
Copy link
Member Author

Yes I am pretty sure it is

@zaverden
Copy link

@roblourens
could you please share plans when it will be implemented?

As I can see, breakpoints work in CJS file even with --experimental-modules flag. I believe, URL-formated paths is only for ESM files, and it'll be this way after they came out of flag.
In this case I believe a due date for file ULRs support is a date of a ESM release, but do you have plans to implement it earlier?

@roblourens
Copy link
Member Author

No immediate plans but do you know when they will be out from the flag or considered "stable"?

@alexewerlof
Copy link

alexewerlof commented Jun 7, 2018

This works on Node 10 (I used nvm):

Open VS Code terminal and make sure you have Node 10:

$ nvm i 10
Downloading and installing node v10.4.0...
Downloading https://nodejs.org/dist/v10.4.0/node-v10.4.0-darwin-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v10.4.0 (npm v6.1.0)

$ node --version
v10.4.0

.vscode/launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceFolder}/index.mjs",
            "runtimeArgs": [
                "--experimental-modules"
            ]
        }
    ]
}

Debug

Now put a breakpoint in your code and press F5 to debug!

roblourens added a commit that referenced this issue Jun 8, 2018
@roblourens roblourens added this to the June 2018 milestone Jun 8, 2018
@roblourens roblourens added bug and removed bug labels Jun 8, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants