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

root.addEventListener is not a function #121

Open
mr-xiao opened this issue Apr 3, 2018 · 4 comments
Open

root.addEventListener is not a function #121

mr-xiao opened this issue Apr 3, 2018 · 4 comments

Comments

@mr-xiao
Copy link

mr-xiao commented Apr 3, 2018

root.addEventListener is not a function

@kentjas1
Copy link

I'm also running into this issue when I am updating my app to use Webpack. I am using the ES6 import to include the npm package I installed.

import echo from "echo-js";

@zlokomatic
Copy link

Also got this issue not using es6 import but with webpack

@pierre-dickinson
Copy link

Hi @zlokomatic @kentjas1
I have the same issue with webpack. What is the solution ?

@toddmotto
Copy link
Owner

toddmotto commented Feb 22, 2020

@pierre-dickinson It's probably due to this and webpack bundling in 'strict mode' as this may be undefined and therefore throw an error as addEventListener won't exist:

https://github.com/toddmotto/echo/blob/master/dist/echo.js#L12

You can change the this to window and that should solve it.

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

No branches or pull requests

5 participants