hammerjs / hammer.js

A javascript library for multi-touch gestures :// You can touch this
http://hammerjs.github.io
MIT License
24.12k stars 2.63k forks source link

Mismatched anonymous define() module #1045

Open harryxue1999 opened 7 years ago

harryxue1999 commented 7 years ago

When Hammer.js is used with AMD (RequireJS), in some cases the hammerjs module is not properly defined due to lack of String ID.

Current implementation: define(function () { return Hammer; });

Suggested implementation: define('hammerjs', [], function () { return Hammer; });

This problem causes require('hammerjs') to fail, causing some important functions (particularly with jQuery) to be undefined.

arjunkathuria commented 7 years ago

you could

var Hammer = require(['hammerjs']);

I'll look into it though.