Angular 4 Universal “window is not defined”

前端 未结 3 1664
故里飘歌
故里飘歌 2021-01-18 19:20

My project was running perfectly but when i implement universal then i am getting \"window is not defined\".

My error is as below.

 node_modules/hamm         


        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 20:14

    You can use @squadette/hammerjs instead of hammerjs. @squadette/hammerjs is server side render friendly.

    To use it, just run

    npm i @squadette/hammerjs 
    

    to instal it. then replace change

    import  'hammerjs';
    

    to

    import  '@squadette/hammerjs';
    

提交回复
热议问题