• Robert Knight's avatar
    Fix client on pages that define a variable called `global` · f732879a
    Robert Knight authored
    Modules which assume the existence of a global variable called "global"
    (which exists in Node) are wrapped by Browserify during the build which
    normally results in "global" being aliased to "self" or "window" in a
    browser environment.
    
    If code on the page into which H is loaded defines a global variable
    called "global" however, that gets used instead and this can break such
    modules. In the case of https://www.civilsprep.com, "global" is a
    reference to a DOM node for example.
    
    This commit fixes the issue by only aliasing "global" (as seen by the
    module using it) to either "window" or "self" and not to any existing
    variable called "global".
    
    Fixes #2723
    f732879a
create-bundle.js 6.04 KB