Hammer.js fails in node since window is undefined
See original GitHub issueHammer.js fails in node since window is undefined. Also document.
Line 2568 assumes window - https://github.com/hammerjs/hammer.js/blob/master/hammer.js#L2568
We’re trying to run a bundle produced by webpack in the web as well as node targets. It would be helpful to include the same bundle even though we’re not using hammer.js on the node side.
jQuery does something like -
typeof window !== "undefined" ? window : this
Issue Analytics
- State:
- Created 8 years ago
- Reactions:18
- Comments:25 (2 by maintainers)
Top Results From Across the Web
How to solve "window is not defined" errors in React and Next.js
Because in the Node.js world, window is not defined, window is only available in browsers. There are three ways to solve that: 1....
Read more >Angular 4 Universal "window is not defined" - Stack Overflow
My error is as below. node_modules/hammerjs/hammer.js:2643 })(window, document, 'Hammer'); ...
Read more >Solve Hammer.JS issue on SSR project - Medium
JS on your Server Side Rendering (SSR) project like the old times, you will receive an error message: ReferenceError: window is not defined....
Read more >@egjs/hammerjs - npm
Start using @egjs/hammerjs in your project by running `npm i @egjs/hammerjs`. ... Hammer.js fails in node since window is undefined.
Read more >API - Hammer.js
Run the recognizer only when the other recognizer fails. Dropping the connection only ... Since it are binary flags, you can use bitwise...
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 Free
Top 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
So this issue is 4 years old and still no solution? 🙄
@graingert could u possibly explain further on how to do that