VSCode tasks.json:找不到preLaunchTask
问题描述:
我有一个multiroot项目:一个阵营客户端和打字稿Express服务器如下:VSCode tasks.json:找不到preLaunchTask
.vscode
launch.json
tasks.json
client
src
package.json
...
server
dist
src
server.ts
package.json
tsconfig.json
webpack.config.js
yarn.lock
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Server",
"program": "${workspaceFolder}/server/src/server.ts",
"outFiles": [
"${workspaceFolder}/server/dist/**/*.js"
],
"preLaunchTask": "build",
"sourceMaps": true
}
]
}
任务。 json
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"identifier": "build",
"group": {
"kind": "build",
"isDefault": true
},
"path": "${workspaceFolder}/server"
}
]
}
该配置在另一个项目中有效,其中package.json位于workspaceFolder
。我以为path
会工作,但我得到Could not find the preLaunchTask 'build'
。
显然,在我的server/package.json
,我有以下几点:
"scripts": {
"build": "yarn clean && webpack",
...
},
答
尝试将.vscode文件夹复制到服务器上的子文件夹:
...
client
...
server
.vscode
launch.json
tasks.json
...