You need to sign in to do that
Don't have an account?
Jigar.Lakhani
LWC > Load Script > Static Resource JS File > Not Working
Hi Folks,
I am building a LWC to load external JS script file in LWC. However whenever loadScript function is executing it is failing to load and there is not error received.
LWC
I am building a LWC to load external JS script file in LWC. However whenever loadScript function is executing it is failing to load and there is not error received.
LWC
import { LightningElement, track } from 'lwc'; import { loadScript } from 'lightning/platformResourceLoader'; import BrandfolderJS from '@salesforce/resourceUrl/BrandfolderJS'; export default class brandFolderLink extends LightningElement { @track blnBrandfolderJSInitialized = false; renderedCallback() { if (this.blnBrandfolderJSInitialized) { return; } this.blnBrandfolderJSInitialized = true; loadScript(this, BrandfolderJS) .then(() => { alert('success.......'); }) .catch(error => { alert('failed.....'+error); }); } }
JS file from Static Resource - Brandfolder JS (https://cdn.brandfolder.com/bf.min.js)
I have created JS file as static resource (BrandfolderJS) and using it in LWC.
LWC is added to App Builder Page/Home Page and trying to load, however it is going to catch block in loadScript method without any error. Error variable is undefined.
Can you please help?
Thank you,
Jigar Lakhani
Have you figured out the solution to this problem?
Thanks,
James
No, Don't have any solution.
However it is not from salesforce, the issue is with Brandfolder JS Library.
Other Libraries are working fine with LWC.
Thank you,
Jigar
https://github.com/amazon-connect/amazon-connect-streams
any solutions?
Thanks
Was it something to do with salesforce's security updates regarding serving static resources via vf domain rather than lightning domain?
refer this StakeExchange (https://salesforce.stackexchange.com/questions/327127/unable-to-load-external-js-scirpt-like-moment-js-after-winter-opt-in-update-rela)
In my case, the issue was that Lightning Locker did not like the imported library. The solution was to enable Lightning Web Security.
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.security_lwsec_intro
I finally realized it was because I had been debugging with `Lightning Web Security` turned off.
Turning it on allows the loadScript function to work correctly in a LightningModal (but it makes debugging harder)
Users have the freedom to merge many recordings into one to produce the whole video using KineMaster,
1mody.com
apkzar.com
kingsrom.com
apkzar.co
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.security_lwsec_intro
Thank you Dmitry Bakovich 7!!
https://developer.salesforce.com/forums/?id=9062I000000XrWiQAK