Enable Debugging for LWC Developers

Enable debugging settings for each LWC developer user who needs to use debugging tools while developing their LWCs.

Debugging settings apply whether you’re using Test Harness or other Salesforce mobile apps during debugging.

Enable Debug Mode

In normal use, Salesforce minifies and compresses JavaScript, HTML, CSS, and other assets for improved performance. These alterations can make it more difficult to debug your components. For example, tracing execution of your component’s JavaScript code is much harder when the code has been minified.

The solution is to enable Debug Mode for users who are developing LWCs.

  • In Salesforce, from Setup, enter Debug Mode in the Quick Find box, then select Debug Mode Users.
  • In the user list, locate any users who need debug mode enabled.
  • Enable the checkbox next to users for whom you want to enable debug mode.

More details, including a more complete description of the effects of Debug Mode, are available in “Enable Debug Mode in Salesforce” in the Lightning Web Components Developer Guide.

Debugging and Lightning Web Security

Lightning Locker and Lightning Web Security (LWS) enhance the security of your Salesforce org by enforcing certain rules about component behavior, partially isolating components from each other, and other measures. The effects on your component code can be significant, but are most likely to be problematic during debugging.

If, during debugging, your efforts are blocked by running into proxy objects, temporarily disable Lightning Web Security. This will allow you to access LWC objects directly, instead of via proxies.

For much more detail, see “Debug Components in an Org With LWS Enabled” in the Lightning Web Components Developer Guide.