Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unsafe of "this" inside module initialization (TypeError: Cannot use 'in' operator to search for 'window' in undefined) #277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jun 12, 2021

  1. Fix unsafe of this inside module initialization (TypeError: Cannot us…

    …e 'in' operator to search for 'window' in undefined)
    
    when using esbuild with vite. this file generates an exception.
    ```
    TypeError: Cannot use 'in' operator to search for 'window' in undefined
        at reqwest.js:15
        at reqwest.js:8
        at ../node_modules/reqwest/reqwest.js (reqwest.js:10)
        at __require2 (chunk-RDZ5XA5N.js?v=dde87764:17)
        at ../node_modules/auth0-js/index.js (index.js:14)
        at __require2 (chunk-RDZ5XA5N.js?v=dde87764:17)
        at dep:auth0-js:1
    ```
    this usage should've
    
    this is how it looks like when compiled with esbuild+vite. "this" is now referencing a different context than the intended window.
    
    using global this will make it more robust.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
    AlonMiz authored Jun 12, 2021
    Configuration menu
    Copy the full SHA
    6218b0c View commit details
    Browse the repository at this point in the history