Why can't I debug my SharePoint Framework solution in production?

Toriyama 281 Reputation points
2022-05-20T09:56:28.737+00:00

Hi,
Since the last production deployment I can no longer find the JS files to debug in production.
In dev with VS Code running I can and the files exist in webpack:///src/webparts/WEBPART/WP.ts
In dev I can get both the localhost workbench and the workbench inside a SharePoint Online site.
In dev there is webpack:///src/webparts/ but in production and I think it existed until this last deploy.

One detail is that before I was working with the published solution and pointing to dev (Without --ship).

What can it be?

In production it should show webpack:///src/, right?

Thanks

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,664 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,573 questions
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 30,996 Reputation points Microsoft Vendor
    2022-05-23T02:23:40.033+00:00

    Hi @Toriyama ,
    Debugging the production version of your SharePoint Framework solution requires two steps: generating the source map for your optimized code, and loading the source map in the browser. If you ever debugged production versions of .NET code using PDBs, it's very much alike.
    By default, the SharePoint Framework toolchain builds source maps only in debug mode. With a small change to the build process, you can have it build source maps for the production version of your solution too.
    Here is the nice article I have found for you to debug production build of a SharePoint Framework solution
    https://blog.mastykarz.nl/debug-production-version-sharepoint-framework-solution/

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful