You need to sign in to do that
Don't have an account?
Carlos Cicero
Hi everyone.
I am trying to load these external libraries that I have in separates static resource, It is only failing to load Fusioncanvg, I know that it depends on Fusionrgbcolor. I know that Fusionrgbcolor loads fine.
How can load both?
Regards,
Carlos
lwc external libraries that dependes on each other
import { LightningElement } from 'lwc'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { loadStyle, loadScript } from 'lightning/platformResourceLoader'; import barcode from '@salesforce/resourceUrl/BarcodeJS' import jdspdf from '@salesforce/resourceUrl/FusionJSpdf' import FusionHTML2canvas from '@salesforce/resourceUrl/FusionHTML2canvas' import Fusioncanvg from '@salesforce/resourceUrl/Fusioncanvg' import Fusionrgbcolor from '@salesforce/resourceUrl/Fusionrgbcolor' export default class PdfTest extends LightningElement { connectedCallback() { Promise.all([ loadScript(this, Fusionrgbcolor ), loadScript(this, barcode ) , loadScript(this, jdspdf ) , loadScript(this, FusionHTML2canvas ), loadScript(this, Fusioncanvg ) ]).then(() => { window.console.log('Files loaded.'); var svgComponent = this.template.querySelector('svg'); JsBarcode(svgComponent, '123123'); }).catch( error => { if(error){ window.console.log('Errors ' + error.message); } window.console.log('Errors ' ); this.dispatchEvent( new ShowToastEvent({ title: 'Error updating record', message: error, variant: 'error' }) ); }); } }
Hi everyone.
I am trying to load these external libraries that I have in separates static resource, It is only failing to load Fusioncanvg, I know that it depends on Fusionrgbcolor. I know that Fusionrgbcolor loads fine.
How can load both?
Regards,
Carlos
Dushyant Sonwar
This might find silly but did you created the CSP Trusted sites . May be your static resource file is using some CDN urls. https://help.salesforce.com/articleView?id=sf.csp_trusted_sites.htm&type=5