-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
ReferenceError: window is not defined on Main.js #1245
Comments
I am also facing same issue, can anyone help me here? |
You need to import hammer from main.ts, not directly from the module. That way, it won't be included server side |
Importing hammer from main.ts doesn't work in Angular 9 |
Actually problem is I am not using hammer.js anywhere in my code but one of the node package @ngu/carousel is using hammer which is giving me trouble. |
Lazy is work ok。 I use Nuxtjs:
|
Thank you, very helpful! |
Thanks for the solution!
|
Thanks for the solution ! Here is a hooks solution in case anyone needs it.
|
im trying to run SSR on my angular8 project but when i run server.js this error happens
`/home/daba/client/dist/server/main.js:288235
})(window, document, 'Hammer');
^
ReferenceError: window is not defined
at Object.yLV6 (/home/daba/client/dist/server/main.js:288235:4)
at webpack_require (/home/daba/client/dist/server/main.js:20:30)
at Object.ZAI4 (/home/daba/client/dist/server/main.js:171354:1)
at webpack_require (/home/daba/client/dist/server/main.js:20:30)
at Object.V7fC (/home/daba/client/dist/server/main.js:161821:10)
at webpack_require (/home/daba/client/dist/server/main.js:20:30)
at Object.K011 (/home/daba/client/dist/server/main.js:125145:37)
at webpack_require (/home/daba/client/dist/server/main.js:20:30)
at Object.0 (/home/daba/client/dist/server/main.js:1251:18)
at webpack_require (/home/daba/client/dist/server/main.js:20:30)
`
i've tried many things but still nothing
The text was updated successfully, but these errors were encountered: