[SalesForce] How to retrieve Lightning Web Components using Ant Migration tool or mdapi:retrieve command from SFDX

This is not clear or obvious how can anyone retrieve Lightning Web Components using Ant Migration tool or mdapi:retrieve command from SFDX?

What is appropriate metadata API component which corresponds to LWC folder components in sfdx?

What should be included in package.xml?

Best Answer

The new Metadata API component is called LightningComponentBundle

The following XML code should be added to package.xml:

<types>
    <members>*</members>
    <name>LightningComponentBundle</name>
</types>