Limitation of $A Global Variable in Aura Components

When Aura components run with LWS, the $A global variable isn’t available to the eval() function or the Function constructor.

There’s no workaround for using $A with eval().

Using eval() with force:refreshView to refresh a view in LWC doesn't work with LWS. Instead, use RefreshView API.

In Aura components, you can use dependency injection for the Function constructor as a workaround when LWS is enabled.

Define the function to accept an extra parameter, $A, which you can supply wherever it is invoked and $A exists on the global scope.

This example constructs a new function fn and specifies $A as one of its parameters, then invokes the function passing a reference to the accessible $A.

The $A variable isn't supported in Lightning web components because it's specific to the Aura framework.

See Also