-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ical.js under CommonJS (Node.js) leaks global ICAL variable #329
Comments
The way globals are set bothered me too in the past, but changing it was quite some effort and is likely not backwards compatible. It looks like Martin is giving it another stab though! |
Is there any update on this? I've had problems using ical.js in Vue.JS in production mode because of the module loader (uncaught reference error). I've worked around the problem by changing line 11 to "var ICAL = module.exports; ", but that's obviously not nice for several reasons. |
I have exacly the same problem in conjuction with fullcalender.io's icalendar plugin, which uses this lib as well. To help other people who have the same problem, here is the exact error, i got in the js console: To fix it, i changed line 11 of
to
|
We ran into this issue as well when trying to use Is there any possibility to get a fix for this problem into |
I'm also not able to use ical from @fullcalendar because of something related to this, it's a runtime error for me:
|
#470 should fix most of this, the rest via es6 modules which is work in progress |
manually downloading and importing the latest timezones build, I got this error: ReferenceError: ICAL is not defined
9 | if (typeof module === 'object') {
10 | // CommonJS, where exports may be different each time.
> 11 | ICAL = module.exports;
| ^
12 | } else if (typeof ICAL !== 'object') {/* istanbul ignore next */
13 | /** @ignore */
14 | this.ICAL = {};
at Object.<anonymous> (src/lib/ical.js:11:7)
at Object.require (src/lib/ical.timezones.js:1:14)
at Object.require (test/calendarUtil.test.js:1:1) had to apply #329 (comment) to fix it |
still not working properly using ical.timzeones.js... |
Hey,
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. ThatICAL
variable should be scoped somehow to not set undesired globals. ;)Cheers
The text was updated successfully, but these errors were encountered: