-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
下面以调试webpack
为例,总共有如下4步:
- 先打开vscode配置文件
.vscode/launch.json
;快捷打开方式:shift + cmd + p
, 输入launch.json
; - 在
launch.json
文件内configurations
位置输入node
,会弹出Launch via NPM
的输入提示:
这时launch.json
里会有如下内容:
// launch.json
"configurations": [{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"debug"
],
"port": 9229
}]
- 修改
package.json
里的debug
内容,注意不能直接写webpack xxx
,要写上具体的执行路径./node_modules/webpack/bin/webpack.js
:
// package.json
{
"scripts": {
"debug": "node --nolazy --inspect-brk=9229 ./node_modules/webpack/bin/webpack.js --mode development --watch --config ./build/webpack.config.prd.js"
}
}
cloudintheking, tyust512 and cool-delete