Ical.js under CommonJS (Node.js) leaks global ICAL variable
See original GitHub issueHey,
Noticed some of my tests failing because they spot a global variable leakage. Turns out https://github.com/mozilla-comm/ical.js/blob/f3b8c7dc24a66424feb1735fe7ff38191e46ab99/lib/ical/helpers.js#L11 sets a global ICAL
that is entirely unnecessary when running under CommonJS modules like when ran under Node.js. That ICAL
variable should be scoped somehow to not set undesired globals. 😉
Cheers
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Ical.js under CommonJS (Node.js) leaks global ICAL variable
Hey, Noticed some of my tests failing because they spot a global variable leakage.
Read more >node-ical - npm
NodeJS class for parsing iCalendar/ICS files. Latest version: 0.15.3, last published: 16 days ago. Start using node-ical in your project by ...
Read more >Understanding Memory Leaks in Nodejs | by Chidume Nnamdi
Global Variable. We learned that in JS's GC MArk-and-Sweep algorithm that global variables are never collected as they are always marked as ...
Read more >@fullcalendar/core | Yarn - Package Manager
FIX: Remove global js 'default' from export maps (#7047) ... #6106); fix: removed accidental ical.js dependency in common's package.json (#6171) ...
Read more >CommonJS modules | Node.js v19.3.0 Documentation
In this example, the variable PI is private to circle.js . The module.exports property can be assigned a new value (such as a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
#470 should fix most of this, the rest via es6 modules which is work in progress
I have exacly the same problem in conjuction with fullcalender.io’s icalendar plugin, which uses this lib as well. It took me hours to find the reason and using the same workaround than @pscs now, which i find quite ugly as well.
To help other people who have the same problem, here is the exact error, i got in the js console: “Uncaught ReferenceError: assignment to undeclared variable ICAL”
To fix it, i changed line 11 of
node_modules/ical.js/build/ical.js
fromto