-
Notifications
You must be signed in to change notification settings - Fork 409
Web-animations.min.js throw exception when using it with Webpack #45
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
Comments
What is Webpack? The capturing of window seems to be a result of uglify. |
(i.e. this is not a bug in web-animations - would you mind following up with the authors of uglify?) |
Okay, I have examined your Gruntfile.js In function compress(...) at line #59 you enable option of UglifyJS: What actually this option do?... It considers that your code is CommonJS module
Since your code is web-browser polyfill (not a CommonJS module) Also this will fix compatibility problem with Webpack and Browserify. |
Hello, Any hints on fixing this? Best regards, Xavier |
Try replace this (in the end of web-animations.min.js file):
With this:
|
Hi @AmberDeBlack Best regards, Xavier |
Sure :) But I'm not maintainer of this repo And maintainer declined my workaround for this problem (read messages above) |
I had a similar issue, but in my instance it was caused by the |
I was able to fix this by doing two things:
You can tweak this, but basically it is setting the "this" reference to "window". |
Hi, I really don't agree that this is a not a bug in As this issue is also present when not using any bundler nor minifier. If one loads this script using <script>
alert(this); // = window
</script>
<script type="module">
alert(this); // = undefined
</script> I hope, that you can reconsider the fact that this is an issue. Thanks, |
Error message:
Cannot set property 'true' of undefined
Error occurred on the very first line:
function(a,b){b["true"]=a
Reason - window object is captured with incorrect code:
function(){return this}
Correct way to get window object (this code taken from jQuery source):
typeof window !== "undefined" ? window : this
The text was updated successfully, but these errors were encountered: