2017-10-14 95 views
0

我有一個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", 
    ... 
}, 

回答

0

嘗試將.vscode文件夾複製到服務器上的子文件夾:

... 
client 
    ... 
server 
    .vscode 
    launch.json 
    tasks.json 
    ... 
相關問題