Thank you Salesforce !!!! for not extending waiting period for releasing local development of lightning components too longer. Local development is nothing but, which enables build, run and test lightning web components without deploying the code to salesforce sandbox or scratch orgs.
To starts with local development, you need to install Local development plugin by running below command on your machine. Salesforce will include these feature into SFDX CLI later since it is beta stage now.
Install lwc-dev-server plugin, open your terminal window and execute it
sfdx plugins:install @salesforce/lwc-dev-server
Check for updates to the local development server.
Create a Salesforce project using SFDX CLI/ VS Code Extension Commands or download
lwc-recipes app from the sample gallery. Also, authorise into a salesforce before you proceed with below command.
sfdx force:auth:web:login -d -a
Next, Run LWC Start Command
As shown above, a local web server has been created for mocking the salesforce context. First screen list all of the lightning web components in your project. You can search for a components and select the component you want.
When you click on any of the listed component, you can preview it on same browser page without deploying the component into salesforce org. Preview page contains options to open the component in VS Code without navigating the component on the VS Code file explorer.
When you make any change on the component, it will automatically refreshes the browser page immediately. Also, local development is to make it easier and faster to find and solve the errors as below.
In addition to above features, local development supports interacting with real org data (for wire annotation) by proxying the datasource with the help of lightning data service. Record Id should be hardcoded to see the specific record detail and data service fetches the record from the org if any.
Local LWC development is in beta stage so there will be lot of missing features, salesforce will introduce them eventually. Take a look at this documentation to know more about the bugs and supported and unsupported features
We can expect extra features or add on from salesforce on next stable release , in order to solve the hard code issue and debugging limitations.
Please refer below documents for more details:https://developer.salesforce.com/blogs/2019/10/announcing-lwc-local-development-beta.html
- Trigger Flow to Run Before a Record Is DeletedMost of you would have thought an option to handle before record deletion via out of the box to …
- Safe Navigation Operator ?.Tired of writing repeated null check statements?? if then here is your new favorite operator(?.) coming from Salesforce as …
- Custom Dependent Picklist in LWC – Part 2In this blog, I would like to share with you the same reusable custom dependent pick-list component which was …