Workflow to Try Your Components with Lightning Web Security

Here’s a suggested workflow for developers to evaluate Lightning web components running with Lightning Web Security.

When you try out your components running in Lightning Web Security, we recommend that you only make code changes that are needed to pass the ESLint rules. If your components work in both LWS and Lightning Locker, you can more easily switch between them if unexpected issues arise. If you refactor components to take advantage of LWS-only features, confine them to your development orgs and don’t push them to production yet. See Using LWS-Only Features.

  1. Download and configure the ESLint rules as described in Install ESLint Rules for Lightning Web Security.
  2. Run the base rule set against your components as described in Run Base Rules Against Your Project.
  3. Fix any errors revealed by the base ESLint rules.
  4. As you fix the errors, try the revised code in the Lightning Web Security Console to see if it can run with LWS.
  5. If your code is affected by distortions, review the distortion descriptions in the LWS Distortion Viewer for help with understanding the issues.
  6. After you fix the linting errors, enable Use Lightning Web Security for Lightning web components and Aura components in a sandbox org, as described in Enable Lightning Web Security in an Org.
  7. Deploy your components to the sandbox org.
  8. Test your components manually and by running your automated tests.
  9. If you notice any abnormal behavior or test results, try running the recommended rule set on your component code to debug any additional issues. You can skip this step if you ran the code in Lightning Web Security Console. The tool runs both sets of ESLint rules.
  10. If your component isn’t performing correctly with Lightning Web Security enabled, or you can’t fix the ESLint errors, go to the Lightning Components Development group on Trailhead to discuss.
  11. If you modified your components to pass ESLint rules, and they now perform well and pass tests in the sandbox, turn off Use Lightning Web Security for Lightning web components and Aura components in the sandbox org.
  12. Clear the browser cache to ensure the correct files are loaded in the browser for Lightning Locker before you begin testing the modified components. If the results aren’t what you expect after clearing the cache, try the other cache-related solutions in Delayed Enabling or Disabling of LWS.
  13. Test the modified components in the sandbox org to ensure they still work well under Lightning Locker after you changed them to pass ESLint rules for LWS. If your components work in both security architectures, you can more easily switch between them if unexpected issues arise later.
  14. When you’re confident that the components work well with Lightning Locker and with Lightning Web Security in the sandbox org, deploy the changes to production.
  15. Ask your Salesforce admin to enable Use Lightning Web Security for Lightning web components and Aura components in production.

See Also