Skip to content

Commit cd7a803

Browse files
committed
fix: opt in to import.meta.* properties
1 parent 124da3f commit cd7a803

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/runtime/router.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ export default defineNuxtPlugin(async nuxtApp => {
3434

3535
const history =
3636
routerOptions.history?.(routerBase) ??
37-
(process.client
37+
(import.meta.client
3838
? routerOptions.hashMode
3939
? createWebHashHistory(routerBase)
4040
: createWebHistory(routerBase)
4141
: createMemoryHistory(routerBase))
4242

4343
const routes = routerOptions.routes?.(_routes) ?? _routes
4444

45-
const initialURL = process.server
45+
const initialURL = import.meta.server
4646
? nuxtApp.ssrContext!.url
4747
: createCurrentLocation(routerBase, window.location)
4848
const router = createRouter({
@@ -138,7 +138,7 @@ export default defineNuxtPlugin(async nuxtApp => {
138138
}
139139

140140
const result = await callWithNuxt(nuxtApp, middleware, [to, from])
141-
if (process.server || (!nuxtApp.payload.serverRendered && nuxtApp.isHydrating)) {
141+
if (import.meta.server || (!nuxtApp.payload.serverRendered && nuxtApp.isHydrating)) {
142142
if (result === false || result instanceof Error) {
143143
const error =
144144
result ||
@@ -159,7 +159,7 @@ export default defineNuxtPlugin(async nuxtApp => {
159159
router.afterEach(async to => {
160160
delete nuxtApp._processingMiddleware
161161

162-
if (process.client && !nuxtApp.isHydrating && error.value) {
162+
if (import.meta.client && !nuxtApp.isHydrating && error.value) {
163163
// Clear any existing errors
164164
await callWithNuxt(nuxtApp, clearError)
165165
}
@@ -171,7 +171,7 @@ export default defineNuxtPlugin(async nuxtApp => {
171171
statusMessage: `Page not found: ${to.fullPath}`,
172172
}),
173173
])
174-
} else if (process.server) {
174+
} else if (import.meta.server) {
175175
const currentURL = to.fullPath || '/'
176176
if (!isEqual(currentURL, initialURL, { trailingSlash: true })) {
177177
const event = await callWithNuxt(nuxtApp, useRequestEvent)
@@ -185,7 +185,7 @@ export default defineNuxtPlugin(async nuxtApp => {
185185
})
186186

187187
try {
188-
if (process.client) {
188+
if (import.meta.client) {
189189
await router.replace({
190190
...router.resolve(initialURL),
191191
name: undefined, // #4920, #4982

0 commit comments

Comments
 (0)