Unlock Instant Salesforce Lightning Web Component Previews: Develop Faster, Debug Smarter

Unlock Instant Salesforce Lightning Web Component Previews: Develop Faster, Debug Smarter

We can preview Salesforce Lightning Web Component locally without saving/deploying the changes to the server.

Steps:

1. Run the following command to update your Salesforce CLI version to the latest. This step helps in avoiding so many issues, errors and exceptions.

sf update

2. Run the following command to install the Local Dev plugin.

sf plugins install @salesforce/plugin-lightning-dev
(OR)
sf plugins install @salesforce/plugin-lightning-dev@latest

Use the following command if you get “Your org is on API version XX.0, but this version of the CLI plugin supports API version XX.0. To use the plugin with this org, you can reinstall or update the plugin using the “prerelease” tag.” exception.

sf plugins install @salesforce/plugin-lightning-dev@prerelease

3. Toggle on “Enable Local Dev” in your Salesforce Setup.

4. Run the following command to preview.

sf lightning dev app

5. Make changes to your Salesforce Lightning Web Component. Just save locally and you should be able to see the changes in your preview without deploying it to the server. This saves a lot of time.

Salesforce Article:

https://developer.salesforce.com/docs/platform/lwc/guide/get-started-test-components.html

Leave a Reply