My static resource
Trying to load this script using loadscript. Below is my code...
import { api,track,LightningElement } from 'lwc';
import {
loadScript
} from 'lightning/platformResourceLoader';
import instascan from '@salesforce/resourceUrl/instascan';
export default class QRCodeScanner extends LightningElement {
@track instascanInitialized = false;
renderedCallback() {
if(this.instascanInitialized){
return;
}
this.instascanInitialized = true;
loadScript(this, instascan)
.then(() => {
console.log('hii then'+then);
})
.catch(error => {
console.log('hii error' +error);
});
}
}
Always getting the same thing in the console
According to the console the catch block is getting executed. But in the network tab I see the static resource is been initialized properly!
Please let me know why am I getting this error even if the static resource is been loaded and how do I resolve this?