Article
4 comments

Lift the curtains on SPFX and improve your debugging

When you are working with SPFX and you start it with gulp serve, it takes some time to start. During this startup many things happen but there are not clear indication if SPFx is working or what it actually does.

gulp server - default start

gulp server – default start

Once the workbench was started you see all the gulp task that will be executed with or without error and what it actually does.
The background tasks are well hidden, but you can take a peek into those background activities. It’s just a simple trick, but I use it every time now when I work with SPFX now.
Instead, execute gulp server and add the command line optionĀ --verbose. Execute SPFx with:

gulp serve --verbose

Now the hidden world and architecture of SPFX will become more visible. In additon you get sometimes many additonal informations what might goes wrong.

gulp serv - with verbose logging

gulp serv – with verbose logging

From my point of view, it is easier and helps with debugging.
I will also see if the issue is caused by your configuration, code or locate a problem with SPFX.

Happy coding!!!

4 Comments

  1. Does –verbose work with –nobrowser ? ie gulp serve –nobrowser — verbose ?

    Reply

    • In my case I used it to debug HandlebarsJS after I switched to verbose I was able to see the complete error message instead of the shortened on.
      You will also see additional messages that will be caught by the framework otherwise.

      Reply

Leave a Reply

Required fields are marked *.


This site uses Akismet to reduce spam. Learn how your comment data is processed.