4

I am currently working in a dev org and I have installed the LWC e-bike component (https://github.com/trailheadapps/ebikes-lwc/tree/master/force-app/main/default/lwc/orderBuilder)

When I create the sfdx project and retrieve the metadata the folder for LWC is empty.

If I create a new LWC through sfdx, it is created without a problem, however, I notice that it is not like lightnining components, were if you manually delete a file you can right click in the folder and hit retrieve and the files appears again.

Is there a trick to be able to retrieve these metadata?

I have added the below into the manifest, as that is what the documentation says that represent the Lightning web component bundle

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

But it doesnt do a thing

EDIT This is my current version when i run

sfdx plugins --core

enter image description here

  • Are you using the latest version of the CLI ? If you run "sfdx plugins --core", what versions are you using ? – Fabien Taillon Feb 11 at 9:16
  • @FabienTaillon I have added an image with the result of running "sfdx plugins --core", I am pretty sure I am running the latest one – manza Feb 11 at 22:34
  • Can you try to uninstall the pre-release (sfdx plugins:uninstall salesforcedx) ? Since yesterday LWC is part of the core sfdx CLI, maybe you'll need to run sfdx update but the pre-release isn't needed anymore. Also, are you on Windows ? There is an ongoing bug currently: github.com/forcedotcom/salesforcedx-vscode/issues/1023 – Fabien Taillon Feb 12 at 9:16
1

There is ongoing bug which is promised to be fixed on the 21 Feb 2019.

Meanwhile you can use the following workaround.

Create package.xml file with the following content

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

    <types>
        <members>*</members>
        <name>LightningComponentBundle</name>
    </types> 
    <version>45.0</version>
</Package>

for example, in force-app folder.

Then create file retrieve.bat in the same force-app folder with the following content.

call sfdx force:mdapi:retrieve -w 5000 -k package.xml -r . 
unzip unpackaged.zip
del unpackaged.zip
rem move unpackaged/lwc/* main/default/lwc
mv unpackaged/lwc/* main/default/lwc
rd /s/q unpackaged

Then close your VS Code and open force-app folder in Git Bash terminal and execute there

./retrieve.bat

And the missed LWC files will be restored.

See this in action: See this in action

1

You can even use :

$ sfdx force:source:retrieve -m LightningComponentBundle
  • This worked for me. Thanks :) – Sree Aug 30 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.