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

Rename the exports variable in preamble.js to instExports #20231

Merged
merged 5 commits into from
Sep 12, 2023
Merged

Rename the exports variable in preamble.js to instExports #20231

merged 5 commits into from
Sep 12, 2023

Commits on Sep 12, 2023

  1. Rename the exports variable in preamble.js to instExports

    This avoids a bug (or limitation) in Google's Closure compiler that does not allow any variable named `exports` to be reassigned. Without this change, some build configurations result in an error message like this:
    
    ```
    [JSC_EXPORT_NOT_AT_MODULE_SCOPE] Exports must be at the top-level of a module  543|
         exports = Asyncify.instrumentWasmExports(exports);  
    ```
    
    The Closure logic lives here, and is intended to block Closure's module exports object from getting reassigned: https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/ClosureCheckModule.java#L436
    
    Since the exports variable used in the preamble is not related to Closure modules, simply renaming the variable does the trick.
    KeatonTech authored Sep 12, 2023
    Configuration menu
    Copy the full SHA
    0d0d168 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aa40da9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5f015f3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    96f320d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    74eedb1 View commit details
    Browse the repository at this point in the history