rangle/angular-ssr

Hammer.js is not loaded

vlodkow opened this issue · 6 comments

When try to use Hummer.js on demand-express example get error from NodeJS: Error: Hammer.js is not loaded, can not bind swipeleft event

Got the same thing today.

ERROR Error: Hammer.js is not loaded, can not bind swipeleft event
at HammerGesturesPlugin.supports (...node_modules@angular\platform-browser\bundles\platform-browser.umd.js:3208:19)
at EventManager.findPluginFor (...packages\platform-browser\src\dom\events\event_manager.ts:80:1)
at EventManager.addEventListener (...node_modules@angular\platform-browser\bundles\platform-browser.umd.js:2430:44)
at EmulatedEncapsulationDomRenderer2.DefaultDomRenderer2.listen (...node_modules@angular\platform-browser\bundles\platform-browser.umd.js:2952:36)
at BaseAnimationRenderer.module.exports.BaseAnimationRenderer.listen (...dist-server\index.js:36400:30)
at listenToElementOutputs (...node_modules@angular\core\bundles\core.umd.js:9232:66)
at createViewNodes (...node_modules@angular\core\bundles\core.umd.js:12191:17)
at callViewAction (...node_modules@angular\core\bundles\core.umd.js:12665:13)
at execComponentViewsAction (...node_modules@angular\core\bundles\core.umd.js:12574:13)
at createViewNodes (...node_modules@angular\core\bundles\core.umd.js:12246:5)
at Object.createEmbeddedView (...node_modules@angular\core\bundles\core.umd.js:12102:5)
at TemplateRef
.createEmbeddedView (...node_modules@angular\core\bundles\core.umd.js:10298:38)
at ViewContainerRef_.createEmbeddedView (...node_modules@angular\core\bundles\core.umd.js:10075:52)
at NgIf._updateView (...packages\common\src\directives\ng_if.ts:159:1)
at NgIf.set [as ngIf] (...node_modules@angular\common\bundles\common.umd.js:1933:18)
at updateProp (...packages\core\src\view\provider.ts:569:1)

Hmmm, strange. I am unable to reproduce. demand-express most certainly imports hammerjs. In main.ts:

import 'hammerjs';

Did you make any local changes?

JinSY commented

@clbond I did a little digging since we were running into some similar issues. I wasn't able to reproduce in the demand-express example but I was able to reproduce in the cli example as well as another barebones cli project with angular-ssr. Just attach a swipe event to an element and it'll throw this error

Did you import hammerjs? There's no reason it shouldn't work

Make sure you are using import 'hammerjs';
and not using import { hammerjs } from "path to hammer js";

dxm99 commented

Make sure you are using import 'hammerjs';
and not using import { hammerjs } from "path to hammer js";

Unless you use custom baseUrl and path. Then you will have to use import '../node_modules/hammerjs';