-
Notifications
You must be signed in to change notification settings - Fork 59
fix: minimization issue with Next.js 15+ #2059
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,7 +183,7 @@ class XHRRequest extends EventEmitter implements IXHRRequest { | |
| Logger.logAction(this.logger, Logger.LOG_ERROR, 'Request.on' + errorEvent.type + '()', errorMessage); | ||
| this.complete(new PartialErrorInfo(errorMessage, code, statusCode)); | ||
| }; | ||
| xhr.onerror = function (errorEvent) { | ||
| xhr.onerror = (errorEvent) => { | ||
| errorHandler(errorEvent, 'XHR error occurred', null, 400); | ||
| }; | ||
| xhr.onabort = (errorEvent) => { | ||
|
|
@@ -193,7 +193,7 @@ class XHRRequest extends EventEmitter implements IXHRRequest { | |
| errorHandler(errorEvent, 'Request cancelled', null, 400); | ||
| } | ||
| }; | ||
| xhr.ontimeout = function (errorEvent) { | ||
| xhr.ontimeout = (errorEvent) => { | ||
| errorHandler(errorEvent, 'Request timed out', null, 408); | ||
| }; | ||
|
|
||
|
|
@@ -306,7 +306,7 @@ class XHRRequest extends EventEmitter implements IXHRRequest { | |
| }); | ||
| }; | ||
|
|
||
| xhr.onreadystatechange = function () { | ||
| xhr.onreadystatechange = () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, if function expressions are a problem in SWC minimization, shouldn't we also change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked into minimized code and a.onerror=function(e){u(e,"XHR error occurred",null,400)}and a.ontimeout=function(e){u(e,"Request timed out",null,408)}it's nothing to inline here. On other hand, here is a.onreadystatechange=function(){let i=a.readyState;i<3||0!==a.status&&(void 0===t&&(t=a.status,(()=>{var s;if(clearTimeout(r),n=t<400,204==t)return this.complete(null,null,null,null,t)...To fix this properly, we need to decide on a strategy for all function declarations across all SDKs. I think it would be good to release this fix first so SDK users don’t have to wait. This definitely doesn’t introduce any new problems but does fix some existing ones.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
huh, so there are multiple places which call
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, changing |
||
| const readyState = xhr.readyState; | ||
| if (readyState < 3) return; | ||
| if (xhr.status !== 0) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.