Delete LWC with Developer Console

This a simple way to query your LWCs and delete them if you have to, with all their consequences.
If you are sure that there is not harm by doing it, you can just search for the LWC you want to delete using the Developer Console.

There are some situations in which you could delete a LWC for a particular reason.
I had once a situation in which I was trying to create a Lightning Component with the name: AccountMap
And I got an error that I was not sure, initially, the reason why…

The reason was that I had a LWC with the same name and that was not allowing me to create a LC.
I renamed the LWC to AccountMapLWC hopping that this will fix the issue… but it didn’t.
I renamed the LWC on my IDE and pushed the changes to my org.
After checking the Page Edit for the Account page layout I saw two LWCs !! , one with the name AccountMap and another with AccountMapLWC.
Did some checksĀ  to make sure that deleting the AccountMap wouldn’t break anything…

From the Developer Console you can use the Query Editor to get LightningComponentBundle.
Use this simple query to get Id and developerName : SELECT Id, developerName FROM LightningComponentBundle

Don’t forget to tick on Use Tooling APIĀ at the right side of the Execute button to be able to execute this particular SOQL.
From the LWCs table select the LWC that you intend to delete and click on Delete Row button.
That should remove that LWC from your org if there is not dependencies…

Leave a Reply

Your email address will not be published. Required fields are marked *