• Robert Knight's avatar
    Fix Hammer.JS error on web pages that use Require.JS · 45d74682
    Robert Knight authored
    Fix an error related to Hammer.JS on client startup on pages that define
    a global variable called `define`, which is part of Require.JS. Hammer's UMD
    bundle does not set `module.exports` in this case, so modules that import it
    get an empty object back.
    
    Fix the issue by making sure that any reference to `define` inside
    bundles evaluates to undefined (assuming there is no local variable
    within the module with that name).
    
    This fixes an issue where clicking "Annotate" failed to open the sidebar
    on BBC News articles (eg. https://www.bbc.co.uk/news/world-52144390).
    45d74682
create-bundle.js 7.97 KB