🤯 This weekend, I discovered an issue trying to debug a Lightning Web Component in the Chrome debugger tools.
UPDATE on 11/13/2022: Salesforce includes a way to automatically disable LWS for your scratch orgs through the security settings in your config/project-scratch-def.json file. You will simply need to add a sessionSetting for lockerServiceNext set to false. Instructions below show you how to do this through Setup. Thanks to Grzegorz Skaruz for pointing this out.
Sharing this, in case anyone becomes as baffled and frustrated as I was. The issue involves the fact that Lightning Web Security (LWS) was installed by default in all orgs with Winter 23. I am not bashing LWS, because I think it is cool and very much needed.
But, for scratch orgs? Not so much.
To still debug your LWC’s, you will need to first disable this feature in your scratch org. You can do this in:
Session Settings -> Uncheck “Use Lightning Web Security for Lightning Web Components”. Click Save.
Unfortunately, it is still hard to see where to go in Chrome Debugger. But, you expand the c subfolder under components (see image below).
Good luck and if you find a better way to do this, please leave a comment below to help others.
There’s a way to create a scratch org with this feature disabled
For example, add these lines to the definition file to disable LWS in your scratch org.
Thanks Gzegorz for letting me know. I will add a NOTE to the top of this blog post indicating this. I figured an option like this would become available at some point.