1

Static Resource not loading in LWC

I have static resource which is loading successfully in Aura Component and Visualforce page but not in the LWC

Folder Structure Staticresource>Cal>fullcalendar.min.js

cal -> folder name fullcalendar.min.js -> javascript file

LWC CODE

import { LightningElement } from 'lwc';
import { loadScript, loadStyle } from 'lightning/platformResourceLoader';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import cal from '@salesforce/resourceUrl/Cal';
import Message from '@salesforce/schema/ApexTestResult.Message';


export default class FullCalender extends LightningElement {

    fullCalenderInitialized = false;

    renderedCallback(){

        if(this.fullCalenderInitialized){
            return;
        }
        this.fullCalenderInitialized = true
        
        Promise.all([
            loadScript(this, cal + '/fullcalendar.min.js')
        ])
        .then(() => {
            console.log('Success');
        })
        .catch(error => {
            console.error({
                Message: 'Error occured on FullCalendarJS',
                error
            });
        });
    }
}
  • what does your aura code look like? if that one works, there's gotta be some typo or something. – willard Nov 23 '20 at 02:01

1 Answers1

0

Files inside the static resource zip packages are case sensitive, so make sure you check that too.