Skip to content
Lightning Web Components

How to Enable Debug Mode for Lightning Web Components in Salesforce?

July 4, 2025

Enable debug mode for Lightning Web Components: Debugging Lightning Web Components (LWC) in Salesforce can be frustrating when everything is minified and unreadable. That’s where Debug Mode comes in — a powerful feature that gives you readable JavaScript, meaningful variable names, and full control over breakpoints and stack traces using your browser’s DevTools.

Enable debug mode for Lightning Web Components

In this post, we’ll walk you through what Debug Mode does, how to enable it, and why it makes a massive difference when working with LWC.

Why Enable Debug Mode?

By default, Salesforce minifies all LWC JavaScript to improve performance. This means:

  • Your source code is compressed into a single-line mess.
  • Variable and function names are shortened.
  • Debugging becomes nearly impossible.

Without Debug Mode:

  • Minified JS: All variables are compressed into meaningless names.
  • No breakpoints: You can’t easily pause execution to inspect data or debug flow.

Here’s what it looks like in Chrome DevTools when Debug Mode is off:

It’s hard to read, right?

How to Enable Debug Mode for LWC?

Enabling Debug Mode is easy and only takes a few seconds:

Steps:

  1. Go to Setup in Salesforce.
  2. Search for “Debug Mode” in the Quick Find box.
  3. Open the Debug Mode settings.
  4. Check the box next to your user.
  5. Click Save.

That’s it! Now Salesforce will serve unminified JavaScript for your components.

Also Learn: How to do polling in LWC?

With Debug Mode Enabled

Once Debug Mode is turned on, your LWC code becomes readable and debuggable:

  • Original function and variable names are visible.
  • You can use debugger; statements or manually add breakpoints in DevTools.
  • Stack traces are meaningful and traceable.

You’ll also notice a key difference in the Sources tab in Chrome DevTools.

File Structure in DevTools:

Without Debug Mode:

  • Only see components/selector/selector.js → Minified and unreadable

With Debug Mode:

  • Also see modules/c/selector/selector.js → Readable, usable for breakpoints

Note:
While the components/ file shows the original code, Salesforce executes code from the modules/ file. So, if you want breakpoints to work properly, place them in the modules version.

Important Note on Performance

Enabling Debug Mode does affect performance:

  • Larger file sizes = slower load times
  • Not suitable for use in production or with real users

Only enable Debug Mode when actively debugging a component, and disable it when done.

Conclusion

Debug Mode for Lightning Web Components is a must-have tool when troubleshooting complex issues. It turns Salesforce’s optimized black-box JS into readable, developer-friendly code — giving you full control over your debugging workflow.

Turn it on when needed, set breakpoints in the right place, and ship better code, faster.

Keep Reading

Related Articles and Resources

How to pass Data from Omniscript to Custom LWC?
July 8, 2025

How to pass Data from Omniscript to Custom LWC?

How to pass Data from Omniscript to Custom LWC? In this...

Salesforce Spring ’26 Release: Upgrade Smart, Don’t Just Upgrade Hard
November 28, 2025

Salesforce Spring ’26 Release: Upgrade Smart, Don’t Just Upgrade Hard

Salesforce Spring ’26 Release: Key updates, behavior...

Introduction to Salesforce Flows: The Game-Changer for Business Automation
October 6, 2025

Introduction to Salesforce Flows: The Game-Changer for Business Automation

Here’s a number that might make you pause: businesses lose...

Salesforce Certification Cost in 2025 (In-Depth Guide)
November 7, 2025

Salesforce Certification Cost in 2025 (In-Depth Guide)

It’s Sunday evening. You’re scrolling through LinkedIn,...

How to Create Test Data in Apex Using Mock API Responses?
July 5, 2025

How to Create Test Data in Apex Using Mock API Responses?

How to create test data in apex using Mock API Responses?...

Merge JSON Lists in OmniStudio DataRaptor
July 9, 2025

Merge JSON Lists in OmniStudio DataRaptor

OmniStudio DataRaptor Transforms include powerful no-code...