How To Delete Lightning Web Component From Org

by Sudipta Deb | Sep 9, 2024 | admin, Lightning Web Component, Salesforce | 0 comments

Sudipta Deb

Sudipta Deb

Founder of Technical Potpourri, Co-Founder of Shrey Tech, Enterprise Cloud Architect

With the introduction of Lightning Web Component, developers can now build lots of cool UI (User Interface) components. In order to develop Lightning Web Component (LWC), developers need an editor (preferably Visual Studio Code) and then deploy the component through package or through changeset. But unlike other metadata available in Salesforce, deleting Lightning Web Component is not that straightforward. You can’t delete a Lightning Web Component from Salesforce Setup. In this blog post, I am going to share couple of ways you can delete the bundle from Salesforce Org.

Watch The Video Or Read The Article (Or Do Both smile)

The form you have selected does not exist.

Understand The Structure of Lightning Web Component

When we create a Lightning Web Component, it comes in a bundle. Here are the components inside the bundle -

HTML file - Defines the component's structure and layout, rendering elements in the browser. It is also known as the template.

JavaScript file - Houses the component's logic, handling events, data manipulation, and interactions. It is also known as module.

Metadata (js-meta.xml) file - Store vital information about the component, including its name, description, and configuration. It also defines the target location where the component has to be displayed.

CSS file (optional) - Contains the styles and appearance rules for the component.

Here is the screenshot from a basic Lightning Web Component named helloWorld.

Delete From Visual Studio Code

In order to delete the Lightning Web Component from Visual Studio Code editor, first you need to fetch the component. So include LightningComponentBundle metadata in your package.xml and retrieve metadata. Once done, you can right click on the Lightning Web Component and select the option "Delete from Project and Org". That's the way to delete it from the Org.

Delete From Developer Console

In order to delete the Lightning Web Component from Developer Console, you need to first execute the below query with Enable Tooling API. 

SELECT Id, apiversion, developerName, FullName, targetConfigs FROM LightningComponentBundle where developerName='helloWorld'

Once the result is available, you need to select the row and hit the button "Delete Row". This is the way to delete Lightning Web Component from org using Developer Console.

Final Thoughts

I hope this blog post will help you. If you have any feedback, please put it in the comment section. If you like this blog post, please subscribe to my blog. Thank you !!

Disclaimer

This article is not endorsed by Salesforce, Google, or any other company in any way. I shared my knowledge on this topic in this blog post. Please always refer to Official Documentation for the latest information.

0 Comments

Leave a Reply

Written by Sudipta Deb

Enterprise Cloud Architect, Content Creator, 20x Salesforce Certified, 1x Google Cloud Certified, 2x Copado Certified

Related Posts

Salesforce Cancels the “Permissions in Profiles” Retirement: What It Means for Admins and Architects

Salesforce Cancels the “Permissions in Profiles” Retirement: What It Means for Admins and Architects

For the last few years, Salesforce administrators, architects, and security teams have been preparing for a major platform change: the retirement of permissions managed directly through Profiles. Salesforce had previously announced plans to move organizations toward a Permission Set–led security model, with enforcement expected to begin around the Spring ’26 timeframe.

read more...

0 Comments

Leave a Reply