Sp-dev-docs: Debug cannot hit breakpoint

Created on 26 Oct 2018  ·  16Comments  ·  Source: SharePoint/sp-dev-docs

OS: macOS Mojave 10.14
VS Code: 1.28.2
Chrome: 70.0.3538.77
yo @microsoft/generator-sharepoint: 1.6.0


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

community docs spfx-general fixed

Most helpful comment

Seems something changed in the code generated by the SPFx Yeoman generator and now the hint paths in the launch.json file is not valid.

Add the following path and it should be working:

"webpack:///.././src/*": "${webRoot}/src/*",

All 16 comments

Please provide your reproducible sample and more other information, such as screenshot. If you run gulp server --nobrowser and then try to use local workbench, you need to run the https://localhost:5432 first.

Thank for Seiyasu. Actually, I have lanched https://localhost:5432/workbench for the first time to debug. However, I still cannot hit the break point, even when the log shows that the line of code has been executed. Screens in below.

2018-10-29 12 03 50
2018-10-29 12 04 36
2018-10-29 12 05 07
2018-10-29 12 05 39

Due to you use local workbench, you should run gulp serve but not gulp serve --nobrowser. The latter is mainly for hosted workbench but not the local.

You can refer to the related issues:
https://github.com/SharePoint/sp-dev-docs/issues/2772
https://github.com/Microsoft/vscode-react-native/issues/625

used 'gulp serve' instead but still not working.
2018-10-29 1 45 24
Uploading 屏幕快照 2018-10-29 下午1.46.13.png…

2018-10-29 1 46 13

Adding statement debugger; as https://github.com/SharePoint/sp-dev-docs/issues/2772#issuecomment-433277028 suggested breaks the code.

However, it breaks the code in a new read-only file, and the break point set in VS Code still don't activated.

With spfx v1.4.1, the break point breaks at the editing file, and after that version, none of the break point set in VS Code breaks. Perhaps spfx v1.5.0 introduced the bug.

I have the same issue, all latest updates are installed.
You can activate breakpoints only after setting the brakepoint on the same line in Chrome as set in vscode . Setting breakpoints in VSCode has no effect. However the debuging actualy happens in VS Code.

Seems something changed in the code generated by the SPFx Yeoman generator and now the hint paths in the launch.json file is not valid.

Add the following path and it should be working:

"webpack:///.././src/*": "${webRoot}/src/*",

Thanks @andrewconnell, that sorted it for me.

Brilliant, cheers @andrewconnell that fixed it

Applause! @andrewconnell

@VesaJuvonen can we get the line provided by @andrewconnell to the launch.json? This is still broken in the latest generator.

This was fixed in current SPFx v1.7.1

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

Was this page helpful?
0 / 5 - 0 ratings

Related issues

christianbueschi picture christianbueschi  ·  3Comments

StfBauer picture StfBauer  ·  3Comments

ken-harris picture ken-harris  ·  3Comments

zerovectorspace picture zerovectorspace  ·  3Comments

jonthenerd picture jonthenerd  ·  3Comments