How to disable lightning locker service by default in community

I have an lwc component to display charts using chartjs library in the community.
The component was working perfectly in internal salesforce but the chartjs library failed to load in the community.

By trial and error, I found this setting in community builder for Locker service which prevents loading of any script(from static resource) in the community.
enter image description here

After disabling this setting the component loads perfectly.

However, I noticed that there is no setting for this in experience bundle JSON(or at least sfdx force:source:pull command doesn’t detect it), and every time in a new org I have to manually disable this setting.

I am using community with this template: Build Your Own (LWR)

Is there a different way to disable this setting without manual effort?

Also shouldn’t this setting block lwc from different namespace instead of blocking all static resources js files even from the same namespace(strangely it allows CSS files from static resource to load)


Source : Link , Question Author : Anmol Kumar , Answer Author : Community

Leave a Comment