Your problem is that you did not include the hammerjs library, which is required by the hammerjs jquery plugin.
To fix this problem, you need to add something like 'hammer':'lib/hammerjs/dist/hammer.min', to your requirejs path 'hammer':'lib/hammerjs/dist/hammer.min',
In addition, here is some related information on how I used hammerjs with requirejs .
In my case, I wanted it to work with backbone and requirejs . I installed the libraries using bower .
bower install
Then I started adding RequireJS configuration:
I noticed that jquery.hammer.js is AMD and automatically requires jquery. He is also quietly dependent on Hammer. It modifies jquery to support Hammer. No gasket.
I noticed that hammerjs is AMD and automatically exports Hammer. No gasket.
I noticed that backbone.hammer is AMD and automatically requires underscore , backbone and hammer . It modifies the base station to support Hammer. No gasket.
Therefore, my configuration uses only paths (since laying support is not required):
require.config({ 'baseUrl':'', 'paths':{ 'underscore':'js/lib/underscore-amd/underscore-min', 'backbone':'js/lib/backbone-amd/backbone-min', 'jquery':'js/lib/jquery/jquery.min', 'hammer':'js/lib/hammerjs/dist/hammer.min', 'jquery-hammer':'js/lib/hammerjs/dist/jquery.hammer.min', 'backbone-hammer':'js/lib/backbone.hammer/backbone.hammer' }, shim:{ 'underscore': { exports: '_' }, 'backbone': { deps: ['underscore', 'jquery'], exports: 'Backbone' } } });
source share