Home  >  Article  >  Development Tools  >  How to debug js code in vscode

How to debug js code in vscode

王林
王林Original
2019-12-14 15:35:543701browse

How to debug js code in vscode

Search for Debugger for Chrome in the extensions on the left and click to install

How to debug js code in vscode

Click f5 under your html project directory, or Select the debug button

How to debug js code in vscode

# on the left and select the drop-down button. There will be an add. It will appear after selecting chrome

How to debug js code in vscode

The configuration file of laungh.json is under your own project directory

How to debug js code in vscode

#However, if you want to debug different code files, you need to modify the configuration file every time

{
    "version": "0.2.0",
    "configurations": [{
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceRoot}"
        },
        {
            "type": "chrome",
            "request": "attach",
            "name": "Attach to Chrome",
            "port": 9222,
            "webRoot": "${workspaceRoot}"
        },
        {
            "name": "Launch index.html (disable sourcemaps)",
            "type": "chrome",
            "request": "launch",
            "sourceMaps": false,
            "file": "${workspaceRoot}/jsTest/test1/test1.html"  #每次需要修改这里的文件地址
        }
    ]
}

Here you can debug, select the Launch index.html (disable sourcemaps) debugging item in

How to debug js code in vscode

##, press f5 to debug, it will appear, and open goole browsing at the same time To enter the debugging stage, click

How to debug js code in vscode

.

Recommended related articles and tutorials:

vscode tutorial

The above is the detailed content of How to debug js code in vscode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn