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

1 Answer 1

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"...

Sign up to request clarification or add additional context in comments.

4 Comments

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?
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?
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!!!!
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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.