![](/img/trans.png)
[英]Visual Studio Task Runner Explorer Extension does not recognize gulpfile.js
[英]How can I debug gulpfile.js when running it with Visual Studio Task Runner Explorer?
如何在使用Visual Studio Task Runner Explorer運行時調試gulpfile.js? 或者是否有另一種方式可以使用visual studio啟動gulp,以便可以調試gulpfile.js? 我知道node-inspector但想看看Visual Studio是否有原生的東西。
我知道你可能期望一種更好的方法,但我現在這樣做的方法是使用普通的
gulpfile.js中的 console.log()語句
這樣我可以檢查變量並嘗試發現任何邏輯錯誤。
使用以下內容在VS Code中“打開文件夾”的文件夾中定義.vscode\\launch.json
文件:
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}/src/node",
"name": "Gulp package node",
"program": "${workspaceRoot}/src/node/node_modules/gulp/bin/gulp.js",
"args": [
"package" // replace this with your gulp task name
]
}
]
}
您顯然希望在上面替換任務名稱和代碼路徑。
然后你可以在VS Code中點擊“Go”,它會在連接調試器的情況下啟動gulp。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.