Salesforce Lightning Web Component – Local development – Prerequisites with Demo
In this post & video to described about the local development for the Lightning web component configuration and simple helloWorld Lightning web component build, run & test it in our Local server.
As a Salesforce developer to buil, run and test it our code into Salesforce developer org/Sandbox, but now the wait is over and we have the option to build, run and test our component from Local server itself instead of deploying into Salesforce Org, so Salesforce made is easy for us to to build the component and fix the errors in local itself before pushing to Salesforce org and also we have the option to access Salesforce real-time data using LDS, UI API and Apex.
Prerequisites:
- Install Visual Studio Code – https://code.visualstudio.com
- Install Salesforce Extension Pack into Visual Studio Code- https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode
- Install Salesforce CLI (SFDXCLI) & Update the plugin- https://developer.salesforce.com/tools/sfdxcli
- Create helloWorld Lightning Web Component – https://github.com/sakthivelsfdc/lwc/tree/master/force-app/main/default/lwc/helloWorld
DEMO:
- Configure Salesforce Org with Visual
> SFDX: Create Project
> SFDX: Create Project with Manifest
> SFDX: Authorize an Org
- Configure Lightning Web Component with Local Development Server (LWC dev server)
sfdx plugins:install @salesforce/lwc-dev-server
sfdx plugins:update
sfdx force:lightning:lwc:start
Resources:
Trailhead – https://trailhead.salesforce.com/en/content/learn/projects/quick-start-lightning-web-components
Announcing LWC Local Development Beta – https://developer.salesforce.com/blogs/2019/10/announcing-lwc-local-development-beta.html
Local Development (Beta) – https://developer.salesforce.com/tools/vscode/articles/lwc/localdev