-
Couldn't load subscription status.
- Fork 62
Description
What happened?
We are encountering a Uncaught SyntaxError: Identifier 'gc' has already been declared error when running our web application within a WebView2 environment. This error specifically points to a const variable named gc.
Our application's JavaScript code undergoes a bundling and minification process, which outputs a const gc variable as part of its optimized code. This bundled code functions correctly without any SyntaxError when directly opened and executed in the Microsoft Edge browser (which WebView2 is based on).
This suggests that the gc identifier is being declared elsewhere within the WebView2 runtime environment, leading to a conflict with our application's const gc declaration. It appears there might be an internal const gc variable or function being injected or used by the WebView2 runtime, causing the identifier collision.
Importance
Blocking. My app's basic functions are not working due to this issue.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
138.0.3351.77
SDK Version
1.0.2903.40
Framework
WinUI3/WinAppSDK
Operating System
Windows 11
OS Version
26100.4484
Repro steps
Steps to Reproduce
- Bundle and minify a JavaScript application that declares a
const gcvariable (or has a minified output that results in such a declaration). - Load this application within a WebView2 control.
- Observe the
Uncaught SyntaxError: Identifier 'gc' has already been declared errorin the WebView2 console.
Expected Behavior
The application's bundled JavaScript should execute without SyntaxError due to identifier conflicts with internal WebView2 runtime variables, especially when the same code runs successfully in the standalone Edge browser.
Actual Behavior
The WebView2 environment throws an Uncaught SyntaxError: Identifier 'gc' has already been declared, preventing the application from loading correctly.
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response