vscode调试vue node ts

838 阅读1分钟

vscode调试vue项目

{
	// 使用 IntelliSense 了解相关属性。
	// 悬停以查看现有属性的描述。
	// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
	"version": "0.2.0",
	"configurations": [
		{
			"type": "chrome",
			"request": "launch",
			"name": "8086",
			"url": "http://localhost:8080", // 访问浏览器地址
			"webRoot": "${workspaceFolder}/src",
			"sourceMaps": true,
			"sourceMapPathOverrides": {
				"webpack:///./*": "${webRoot}/*",
				"webpack:///src/*": "${webRoot}/*",
				"webpack:///*": "*",
				"webpack:///./~/*": "${webRoot}/node_modules/*",
				"meteor://💻app/*": "${webRoot}/*"
			}
		}
	]
}

vscode 调试node koa项目

{
  // 使用 IntelliSense 了解相关属性。 
  // 悬停以查看现有属性的描述。
  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
     "request": "launch",
      "name": "Launch Program",
      "program": "${workspaceFolder}/bin/www",
      "runtimeExecutable": "nodemon", //需要安装nodemon
      "restart": true,
      "console": "integratedTerminal",
      "skipFiles": [
        "${workspaceRoot}/node_modules/**/*.js",
      "<node_internals>/**/*.js"
      ]
    }
  ]
}

vue调试ts开发node项目.

launch.json

{
  // 使用 IntelliSense 了解相关属性。 
  // 悬停以查看现有属性的描述。
  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch via NPM",
      "runtimeExecutable": "npm",
      "runtimeArgs": [
        "run-script",
        "dev"
      ],
      "port": 9229,
      "skipFiles": [
        "<node_internals>/**"
      ]
    }
  ]
}

package.json(需要按照nodemon)

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": " nodemon --watch src -e ts --exec ts-node ./src/app.ts"
  },