From 7ee15a185447c617787428c4d6e2f68a251099a3 Mon Sep 17 00:00:00 2001 From: jos Date: Thu, 10 Jul 2014 12:00:46 +0200 Subject: [PATCH] Try to load hammer.js from window before loading via require() --- lib/module/hammer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/module/hammer.js b/lib/module/hammer.js index fbea30d3..64f60f15 100644 --- a/lib/module/hammer.js +++ b/lib/module/hammer.js @@ -1,7 +1,8 @@ // Only load hammer.js when in a browser environment // (loading hammer.js in a node.js environment gives errors) if (typeof window !== 'undefined') { - module.exports = require('hammerjs'); + module.exports = window['Hammer'] || require('hammerjs'); + // TODO: throw an error when hammerjs is not available? } else { module.exports = function () {