question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@fullcalendar/icalendar plugin seems broken?

See original GitHub issue

When I try installing @fullcalendar/icalendar to import ical formats into FullCalendar in a SvelteKit app, I get the following error:

ICAL is not defined
ReferenceError: ICAL is not defined
    at node_modules/ical.js/build/ical.js (http://localhost:3000/node_modules/.vite/chunk-MWROEMAF.js?v=d2a4f7e5:9:12)
    at __require (http://localhost:3000/node_modules/.vite/chunk-B7LZDY4N.js?v=d2a4f7e5:41:44)
    at http://localhost:3000/node_modules/.vite/@fullcalendar_icalendar.js?v=d2a4f7e5:16:23

Any thoughts on a fix?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
notKamuicommented, Dec 23, 2021

@sbutler-gh @YogliB to recapitulate (so that you can put it somewhere) :

In case you want to use the fullcalendar/icalendar plugin, an issue might arise in projects where modules or strict mode are enabled (so, incidentally, with Svelte), and is caused by a dependency of fullcalendar (which is ical.js).

It is due to the fact that they assign a variable without declaring it.

A possible hotfix would be this :

  • Create a postinstall.js file at the same level as your package.json, with the following content :
const fs = require('fs');

fs.readFile('node_modules/ical.js/build/ical.js', 'utf8', (err, data) => {
    if (err) {
        throw err
    } else {
        if (data.startsWith("let ICAL;")) return;
        fs.writeFile('node_modules/ical.js/build/ical.js', "let ICAL;\n" + data, (err) => {
            if (err) throw err;
        });
    }
});
  • add the following run script to your package.json:
{
    "scripts": {
        "postinstall": "node postinstall"
    }
}

This will patch the library after each npm install

1reaction
sbutler-ghcommented, Nov 14, 2021

can you link a reproduction?

Here’s a repo reproducing the error (https://github.com/sbutler-gh/icalendar-bug). To reproduce:

  1. Install the repository locally (git clone https://github.com/sbutler-gh/icalendar-bug.git)
  2. npm run install
  3. npm run dev

When I navigate to localhost:3000, the browser shows:

ICAL is not defined
ReferenceError: ICAL is not defined
    at node_modules/ical.js/build/ical.js (http://localhost:3000/node_modules/.vite/@fullcalendar_icalendar.js?v=6fbf720c:15:12)
    at __require (http://localhost:3000/node_modules/.vite/chunk-OZKD6XBJ.js?v=6fbf720c:9:44)
    at http://localhost:3000/node_modules/.vite/@fullcalendar_icalendar.js?v=6fbf720c:5124:24
    ```
Read more comments on GitHub >

github_iconTop Results From Across the Web

@fullcalendar/icalendar | Yarn - Package Manager
FullCalendar iCalendar Plugin. Display events from a public iCalendar feed. Installation. First, ensure ical.js is installed: npm install ical.js.
Read more >
Fullcalendar layout broken because CSS loading after ...
The fullcalendar.js renders (and positions) calendar events. The positions are calculated wrong if the fullcalendar.css file is not yet loaded at that point ......
Read more >
Full-calendar event not showing properly. How to fix?
I've recently added full-calendar to my website and noticed that the events are not shown correctly. for example: if the event is from...
Read more >
Fullcalendar will not display | WordPress.org
Having issue getting the plugin working again. Uncaught TypeError and a bunch of jquery.qtip errors. Page loads event list fine, but Calendar spinner...
Read more >
V4 Release Notes and Upgrade Guide - Docs v4 - FullCalendar
It is also the first time connector plugins to third-party libraries are offered. Major breaking changes: Removal of jQuery as a dependency. Consequently:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found