I've retrieved my LWC source from the org, and then tried right clicking on the component folder in VS code (under force-app\main\default\lwc) and clicking SFDX: Delete from Project and Org, which then runs the command sfdx force:source:delete --sourcepath "path\to\project\force-app\main\default\lwc\myComponentName" --noprompt
In the output in the console, I can see it listing the components of the LWC, but then it reports a component failure, and the deployment fails.
=== Deleted Source
FULL NAME TYPE PROJECT PATH
─────────────── ──────────────────────── ──────────────────────────────────────────────────────────────────
myComponentName LightningComponentBundle force-app\main\default\lwc\myComponentName
myComponentName LightningComponentBundle force-app\main\default\lwc\myComponentName\myComponentName.css
myComponentName LightningComponentBundle force-app\main\default\lwc\myComponentName\myComponentName.html
myComponentName LightningComponentBundle force-app\main\default\lwc\myComponentName\myComponentName.js
myComponentName LightningComponentBundle force-app\main\default\lwc\myComponentName\myComponentName.js-meta
=== Component Failures [1]
Type Name Problem
─────── ────────────────────── ────────────────────────────────────────────────────────
Warning destructiveChanges.xml No LightningComponentBundle named: myComponentName found
I'm not sure what exactly it's looking for here.
I've tried creating a destructiveChanges.xml file using the command sfdx force:source:manifest:create --sourcepath force-app\main\default\lwc\myComponentName -t destroy
, and then trying the delete again, however the error still persists.
What am I doing wrong?
Best Answer
It appears that I had already deleted the LWC, and I just had a local copy of it in VS code.
I had been trying to delete it multiple ways, and it looks like one of them must have worked as it's no longer there in the org browser.