๐Ÿ‘€Trouble Shooting Lightning Web Component (LWC) ๐Ÿ‘€

Lightning Web Component is Compiled and Minified. This means the javascript code in minified format. Mininfcation leads to faster rendering of components on the web page. Since the code is minified it will be very difficult for the developer to debug the code on browser tools in case of any error. When minified code renders on the browser javascript codes will not be in a  beautified format and there will be a replacement of the variable we defined on the original JS file. This makes the developer job tedious on debugging. 

So what is the Solution?

Enabling Debug Mode 

Enabling debug mode makes the developer's job easy on troubleshooting the error. 

Once the Debug mode is enabled in Org for a specific user JS code won't render in Minified format. So the variable names will remain unchanged and the code will render in a beautiful format. This makes it easy for a developer to debug the issue. 

Note: I would recommend not enabling the Debug mode on Production. If you enable in Production or UAT environment, will result in performance issue. So it is wise to enable debug mode in the Development environment.

How to enable Debug Mode?

Goto Set up --> Search For Debug Mode-->Select the User --> Click on Enable button.













LWC JS code before enabling Debug Mode













In the above screenshot, you can see Control LWC component has a control.js file. 

It has handleAdd() method and it is minified. 

Now I am going to enable the debug mode and let's see the difference. 












Now you can see the beautified code ๐Ÿ˜

Happy Coding. 

Thank you ๐Ÿ˜€



Comments

Post a Comment

Popular posts from this blog

Vlocity Learning..

LWC Publish Subscriber