Skip to content

Commit d874726

Browse files
committed
fix(nuxt): guard window access
1 parent 54f5b9e commit d874726

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/nuxt/src/pages/runtime/validate.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export default defineNuxtRouteMiddleware(async (to) => {
2929
// We pretend to have navigated to the invalid route so
3030
// that the user can return to the previous page with
3131
// the back button.
32-
window?.history.pushState({}, '', to.fullPath)
32+
if (typeof window !== 'undefined') {
33+
window.history.pushState({}, '', to.fullPath)
34+
}
3335
})
3436
// We stop the navigation immediately before it resolves
3537
// if there is no other route matching it.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy