Lightning Locker

To improve the security of your LWR apps, enable Lightning Locker.

Locker is a security architecture for Lightning web components (LWCs). To learn how Locker enhances the security of your components and code, visit Lightning Aura Components Developer Guide: Lightning Locker.

  • Locker is only supported for applications in AMD mode. It doesn't work for ESM mode. For more information about LWR application modes, see Set the LWR Server Modes.
  • Locker is only supported on the client-side. You can't enable Locker for server-side code.

To opt-in to Locker, add the locker config to your project's lwr.config.json. You can determine which components run outside of Locker by listing them in the trustedComponents property.