fix(ssr): suppress lifecycle hook errors (nextSibling null) at process level to prevent SSR crashes
This commit is contained in:
@@ -1,3 +1,18 @@
|
|||||||
|
// Suppress unhandled errors from browser API calls in SSR lifecycle hooks
|
||||||
|
// (e.g. Inertia Link tries this.$el.nextSibling which is null in SSR)
|
||||||
|
process.on('unhandledRejection', (reason) => {
|
||||||
|
if (reason instanceof TypeError && reason.message?.includes('nextSibling')) {
|
||||||
|
return; // Suppress known SSR lifecycle hook errors
|
||||||
|
}
|
||||||
|
console.error('SSR unhandled rejection:', reason);
|
||||||
|
});
|
||||||
|
process.on('uncaughtException', (err) => {
|
||||||
|
if (err instanceof TypeError && err.message?.includes('nextSibling')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.error('SSR uncaught exception:', err);
|
||||||
|
});
|
||||||
|
|
||||||
if (typeof globalThis.IntersectionObserver === 'undefined') {
|
if (typeof globalThis.IntersectionObserver === 'undefined') {
|
||||||
globalThis.IntersectionObserver = class {
|
globalThis.IntersectionObserver = class {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user