Skip to content
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

cannot be used in type="module" mode #449

Closed
TimDaub opened this issue Jul 14, 2020 · 1 comment
Closed

cannot be used in type="module" mode #449

TimDaub opened this issue Jul 14, 2020 · 1 comment

Comments

@TimDaub
Copy link

TimDaub commented Jul 14, 2020

Hi,

I'm using microbundle to include "ical.js". It's modern and module options allow to include the bundled js as a <script type="module" src="bundle.js"></script>

However, when I start my application, I get the following error:

Uncaught ReferenceError: assignment to undeclared variable ICAL

this is because ICAL is never officially initialized.

https://github.com/mozilla-comm/ical.js/blob/dcfe5a67527e73f54db21fbc31f23670a29704b8/lib/ical/helpers.js#L11

Now, in a normal environment <script src="bundle.js"></script>, this wouldn't be a problem as strict mode isn't enabled by default. For Javascript modules though, strict mode is always on:

ECMAScript 2015 introduced JavaScript modules and therefore a 3rd way to enter strict mode. The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.

I'm not sure how to handle this exactly, but a naive guess would have been to do further feature-detection. E.g. of ES6 modules. SO has an idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants