3

I am having some difficulties importing LWC components from org to VSCODE. Is it the right way? Here's what I am following -

  1. Created a new Manifest project.
  2. Connected to my sandbox org (not scratch).
  3. Right clicked on Package.xml under Manifest & selected - Retrieve source in Manifest from Org.

enter image description here

Praveen Behera
  • 444
  • 2
  • 8
  • 17

1 Answers1

2

Yes, should work. Does your package.xml contain

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

Are you sure you're connecting to right org? If you Ctrl+Shift+P -> Open default org, do you land in the sandbox that contains this component? Any errors when you retrieve? sfdx is installed ok?

Do you see your component if you open developer console, query tab, tick the Tooling API checkbox(!) and run SELECT DeveloperName FROM LightningComponentBundle?

If all else fails you can query the bodies with Tooling API's SELECT Id, FilePath, Format, Source FROM LightningComponentResource but it should "just work"...

eyescream
  • 18,088
  • 2
  • 34
  • 46
  • Thank you very much for your response. Yes, SFDX is installed and I also checked using your query (tooling API), and its retrieving data. I am new. Maybe data is retrieved and I do not know where to see it. I am checking under LWC folder and its not there. Any suggestions? – Praveen Behera Apr 28 '22 at 09:56
  • 1
    with default project config they should end up in lwc directory, yes. (if your project.json file contains `"path": "force-app"` then they should end up in `force-app\main\default\lwc`). You can try right clicking the directory and hitting "retrieve source from org" too... What happens when you run `sfdx force:mdapi:retrieve -r ./mdapi -k ./manifest/package.xml`? it should download a zip with your source code to "mdapi" folder. any errors? – eyescream Apr 28 '22 at 11:28
  • Hi Eyescream, What I did was - Refreshed all org data from the left cloud icon and downloaded Apex and Lightning Web Components and it worked. But thank you so much for your assistance!!!! – Praveen Behera May 02 '22 at 06:44
  • 1
    weird, I almost never use that icon to be honest, normal deploy / retrieve or push/pull "just works"... Maybe password expired or something. well, glad I could help a bit! – eyescream May 02 '22 at 06:57