小编Gil*_*d.T的帖子

使用Create-React-App进行VSCode调试

我想设置我的VS代码来调试使用'create-react-app'创建的React-app.

我试过这个配置:

{
    "version": "0.1.0",
    "configurations": [
        {
            "name": "Launch node",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/src/index.js",
            "cwd": "${workspaceRoot}",
            "preLaunchTask": null,
            "runtimeExecutable": null,
            "runtimeArgs": [
                "--nolazy"
            ],
            "env": {
                "NODE_ENV": "development"
            },
            "sourceMaps": true,
            "outFiles": []
        },
        {
            "name": "Attach",
            "type": "node",
            "request": "attach",
            "port": 9222,
            "address": "localhost",
            "restart": false,
            "sourceMaps": false,
            "localRoot": "${workspaceRoot}",
            "remoteRoot": null
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

但我得到错误以下错误:

Debugger listening on port 11198
e:\form\src\index.js:1
(function (exports, require, module, __filename, __dirname) { import React from 'react';
                                                             ^^^^^^

SyntaxError: Unexpected …
Run Code Online (Sandbox Code Playgroud)

debugging visual-studio-code create-react-app vscode-settings

4
推荐指数
1
解决办法
2986
查看次数