8000 docs: revert `import.meta.*` update until v3.7 release · nuxt/nuxt@98c17e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 98c17e5

Browse files
committed
docs: revert import.meta.* update until v3.7 release
1 parent e04596a commit 98c17e5

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

docs/1.getting-started/7.state-management.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ export const useLocale = () => useState<string>('locale', () => useDefaultLocale
7474

7575
export const useDefaultLocale = (fallback = 'en-US') => {
7676
const locale = ref(fallback)
77-
if (import.meta.server) {
77+
if (process.server) {
7878
const reqLocale = useRequestHeaders()['accept-language']?.split(',')[0]
7979
if (reqLocale) {
8080
locale.value = reqLocale
8181
}
82-
} else if (import.meta.client) {
82+
} else if (process.client) {
8383
const navLang = navigator.language
8484
if (navLang) {
8585
locale.value = navLang

docs/2.guide/2.directory-structure/1.middleware.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ However, if you want to avoid this behaviour you can do so:
125125
```js
126126
export default defineNuxtRouteMiddleware(to => {
127127
// skip middleware on server
128-
if (import.meta.server) return
128+
if (process.server) return
129129
// skip middleware on client side entirely
130-
if (import.meta.client) return
130+
if (process.client) return
131131
// or only skip middleware on initial client load
132132
const nuxtApp = useNuxtApp()
133-
if (import.meta.client && nuxtApp.isHydrating && nuxtApp.payload.serverRendered) return
133+
if (process.client && nuxtApp.isHydrating && nuxtApp.payload.serverRendered) return
134134
})
135135
```
136136

docs/2.guide/2.directory-structure/1.plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default defineNuxtPlugin({
6262
```
6363

6464
::alert
65-
If you are using an object-syntax plugin, the properties may be statically analyzed in future to produce a more optimized build. So you should not define them at runtime. For example, setting `enforce: import.meta.server ? 'pre' : 'post'` would defeat any future optimization Nuxt is able to do for your plugins.
65+
If you are using an object-syntax plugin, the properties may be statically analyzed in future to produce a more optimized build. So you should not define them at runtime. For example, setting `enforce: process.server ? 'pre' : 'post'` would defeat any future optimization Nuxt is able to do for your plugins.
6666
::
6767

6868
## Plugin Registration Order

docs/2.guide/3.going-further/10.runtime-config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ The entire runtime config is available on the server-side, but it is read-only t
9494
<script setup lang="ts">
9595
const config = useRuntimeConfig()
9696
console.log('Runtime config:', config)
97-
if (import.meta.server) {
97+
if (process.server) {
9898
console.log('API secret:', config.apiSecret)
9999
}
100100
</script>

docs/2.guide/3.going-further/8.custom-routing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,6 @@ import { createMemoryHistory } from 'vue-router'
138138

139139
// https://router.vuejs.org/api/interfaces/routeroptions.html
140140
export default <RouterConfig> {
141-
history: base => import.meta.client ? createMemoryHistory(base) : null /* default */
141+
history: base => process.client ? createMemoryHistory(base) : null /* default */
142142
}
143143
```

docs/3.api/1.composables/use-nuxt-app.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default defineNuxtPlugin((nuxtApp) => {
4545
})
4646
nuxtApp.hook('vue:error', (..._args) => {
4747
console.log('vue:error')
48-
// if (import.meta.client) {
48+
// if (process.client) {
4949
// console.log(..._args)
5050
// }
5151
})
@@ -105,7 +105,7 @@ When accessing the same `payload.data` from [ssrcontext](#ssrcontext), you can a
105105
export const useColor = () => useState<string>('color', () => 'pink')
106106

107107
export default defineNuxtPlugin((nuxtApp) => {
108-
if (import.meta.server) {
108+
if (process.server) {
109109
const color = useColor()
110110
}
111111
})
@@ -137,7 +137,7 @@ export default defineComponent({
137137
setup (_props, { slots, emit }) {
138138
const nuxtApp = useNuxtApp()
139139
onErrorCaptured((err) => {
140-
if (import.meta.client && !nuxtApp.isHydrating) {
140+
if (process.client && !nuxtApp.isHydrating) {
141141
// ...
142142
}
143143
})

0 commit comments

Comments
 (0)
0