我一般用console.log()和debugger。
调试起来有点麻烦。
有没有好的工具或者方法推荐一下,谢谢!
Redux DevTools
具体说下麻烦在哪里?感觉和正常 react 项目没啥区别啊
@zhangdongming1989 浏览器端代码和工程代码差别比较大,debug起来有难度,不想jQuery那样直观
把 roadhog 更新到 2.3.0 即可生成正确的 Source Map
I changed in package.json the following:
"babel-plugin-import": "^1.6.4",
"roadhog": "^2.3.0",
Now I can debug with no problems using vscode and chrome/sources
I changed in package.json the following:
"babel-plugin-import": "^1.6.4", "roadhog": "^2.3.0",
- Please run again: npm install
Now I can debug with no problems using vscode and chrome/sources
but I can't work as you say
I created my project by 2.1.1 version.
Step 1: set a debug configration on /.vscode/launch.json, like this:
"configurations": [
{
"name": "Launch Chrome For Debug",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8000",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"userDataDir": "${workspaceRoot}/.vscode/chrome"
}
]
step 2 : In vscode's terminal, run >npm start . The default browser will auto open http://localhost:8000
step 3 : Open VSCode's debug panel, choose the "Launch Chrome For Debug" and click the Debug button. A chrome browser will be opened.
Then you can created some breakpoints in VSCode and debug it by F10.
It's ok for me today. 2018-11-23
@
I created my project by 2.1.1 version.
Step 1: set a debug configration on /.vscode/launch.json, like this:
"configurations": [
{
"name": "Launch Chrome For Debug",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8000",
"sourceMaps": true,
"webRoot": "${workspaceRoot}",
"userDataDir": "${workspaceRoot}/.vscode/chrome"
}
]step 2 : In vscode's terminal, run >npm start . The default browser will auto open http://localhost:8000
step 3 : Open VSCode's debug panel, choose the "Launch Chrome For Debug" and click the Debug button. A chrome browser will be opened.
Then you can created some breakpoints in VSCode and debug it by F10.
It's ok for me today. 2018-11-23
嗯,使用vscode添加一个chrome debug配置,然后端口改为8000,就可以点击Debug按钮来Debug了,原来 so easy
Most helpful comment
把 roadhog 更新到 2.3.0 即可生成正确的 Source Map