Just trying to load a js library in a LWC. Cannot even get the thing to load. I just want it to load and do nothing.

Static resource here:

Name headerConfig
Namespace Prefix    
MIME Type   text/javascript
Cache Control   Private
Size    615 bytes
import { LightningElement } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { loadScript, loadStyle } from 'lightning/platformResourceLoader';
import headerConfig from '@salesforce/resourceUrl/headerConfig';

export default class UtahHeader extends LightningElement {

successMessage = '';
utahHeaderInit = false;

renderedCallback() {
    // if(this.utahHeaderInit) {
    //     return;
    // }

    // this.utahHeaderInit = true;
    loadScript(this, headerConfig)
    .then(() => {
        this.error = undefined;
        // this.loadConfig();
        // this.loadMainMenu();
    .catch(error => {
        this.error = error;
            new ShowToastEvent({
                title: 'Errrorrr',
                variant: 'error',

showSuccessMessage() {
    this.successMessage = 'loaded succ';
    alert('scripts loaded succ');
    <lightning-card title="Third Party Library Demo" icon-name="custom:custom19">
        <p><b style="color:blue;">{successMessage}</b></p>

Any ideas what I'm doing wrong here? Tried to follow other posts but I'm able to rectify mine.. if I try to add error.message, it says it's an undefined property so I can't even find out what the issue is.

1 Answer 1


Nvm, seems like a problem with the external library itself. React loads fine.

  • Do you have a link to the 3rd party library (so I can download and try it)?
    – arut
    Aug 15, 2020 at 4:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .