question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hammer.js fails in node since window is undefined

See original GitHub issue

Hammer.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:open
  • Created 8 years ago
  • Reactions:18
  • Comments:25 (2 by maintainers)

github_iconTop GitHub Comments

21reactions
daviddelusenetcommented, Sep 9, 2020

So this issue is 4 years old and still no solution? 🙄

8reactions
Tatendacommented, Jan 29, 2018

@graingert could u possibly explain further on how to do that

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found