Lightning Web Component Local Development Setup# and Installation

Salesforce developers great news! LWC ( Lightning Web Component) Local Development Beta is released by Salesforce.  This local development feature will help us to build, run and test the lightning web component on our local machine, we do not need to deploy the code on our salesforce org. Big Thanks to the LWC team.

This (Local Development) will reduce the time for LWC development and testing. This will definitely increase the productivity of the salesforce developer.

The Local Development Server is available through the Salesforce CLI plugin. It is configured and runs a Lightning Web Component-enabled server on the local machine.

Setup# and Installation: 

Setup: 

Installation:

  • Open a terminal window (CMD run as administrator) and run the following command to install the LWC local development server on your machine.
 sfdx plugins:install @salesforce/lwc-dev-server
1
  • Check for updates to the local development server.
 sfdx plugins:update
2
  • Open your VS Code IDE and add the.localdevserverfolder in your SFDX project to your.gitignorefile. Do not modify files inside of this folder.
3
  • Authorize a Developer Hub (Dev Hub) in the VS Code and through CMD.
sfdx force:auth:web:login --setdefaultdevhubusername
  • Log in using your Dev Hub credentials.
4
  • Start the server.
sfdx force:lightning:lwc:start
5

  • You can see all the LWC that you created in your org. Click on your favorite component to run.
7
  • c-hello-web-component: you can see this web component rendered in-browser without deploying to the org.
6
  • If you click on the button “View in VS Code” this will quickly open the component code in your VS Code IDE. When you can make any changes in the component code, those changes will refresh in the browser immediately.

Arun Kumar

Arun Kumar is a Salesforce Certified Platform Developer I with over 7+ years of experience working on the Salesforce platform. He specializes in developing custom applications, integrations, and reports to help customers streamline their business processes. Arun is passionate about helping businesses leverage the power of Salesforce to achieve their goals.

This Post Has One Comment

Leave a Reply