Understanding how debugging works
Before knowing how to debug, it is important to know how debugging works for JavaScript applications and what the core concepts behind this process are.
As mentioned at the very beginning of this book in Chapter 1, Introducing Microsoft 365 and SharePoint Online for Developers, SPFx solutions are client-side solutions, meaning they use JavaScript code executed directly in a web browser (among various other assets, such as CSS and images). To be able to debug them efficiently, JavaScript solutions rely on source map files.
Source maps are an essential feature in modern web development that greatly simplify the debugging process. Because the SPFx build toolchain uses many intermediate steps before producing the final JavaScript bundle, making several transformations on it (transpiling, minifying, etc.), the code structure you wrote in your editor won’t be the code executed in the browser. This makes it difficult to follow and understand...
 
                                             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
     
         
                 
                 
                 
                 
                 
                 
                 
                 
                