stephband / jquery.event.swipe

jQuery custom events swipeleft, swiperight, swipeup and swipedown
stephband.info/jquery.event.swipe
446 stars 180 forks source link

Depends on jquery.event.move but not "required" #35

Closed rdehouss closed 8 years ago

rdehouss commented 8 years ago

Hi,

This plugin depends on jquery.event.move but the require statement does not "ask" it.

define(['jquery'], thisModule);

Shouldn't it be define(['jquery', undefined, 'jquery.event.move'], thisModule); ?

My current issue is that when I require jquery.event.swipe, I have to configure a shim to say it relies on jquery.event.move but during the r.js optimization, despite the fact that move is inserted, swipe does not know move because nobody asked for "move".

My current workaround is to rewrite the plugin:

onBuildWrite: function (moduleName, path, contents) { if ( moduleName === 'jquery.event.swipe' ) { return contents.replace(/\['jquery'\]/g, "['jquery', undefined, 'move']"); } else { return contents; } },

WDYT?

Thanks!

Cheers,

Raphaël

stephband commented 8 years ago

You're right, of course. Here's a commit for that:

https://github.com/stephband/jquery.event.swipe/commit/355d015abf34430ddb5a387555897ef43cf3a2b1

rdehouss commented 8 years ago

Thx for your really prompt intervention!