From 146b966c757acd098f83366f9825479ac64a5413 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 25 Mar 2024 12:46:46 +0000 Subject: [PATCH] fix: opt in to `import.meta.*` properties --- docs/content/2.advanced/1.vue-instantsearch.md | 2 +- src/runtime/components/AlgoliaDocSearch.vue | 4 ++-- src/runtime/composables/useAlgoliaSearch.ts | 2 +- src/runtime/composables/useAsyncAlgoliaSearch.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/content/2.advanced/1.vue-instantsearch.md b/docs/content/2.advanced/1.vue-instantsearch.md index 5b729af..ba2d4db 100644 --- a/docs/content/2.advanced/1.vue-instantsearch.md +++ b/docs/content/2.advanced/1.vue-instantsearch.md @@ -80,7 +80,7 @@ onBeforeMount(() => { }) const { data: algoliaState } = await useAsyncData('algolia-state', async () => { - if (process.server) { + if (import.meta.server) { const nuxtApp = useNuxtApp(); nuxtApp.$algolia.transporter.requester = ( await import('@algolia/requester-node-http').then( diff --git a/src/runtime/components/AlgoliaDocSearch.vue b/src/runtime/components/AlgoliaDocSearch.vue index 3194e54..a1357ca 100644 --- a/src/runtime/components/AlgoliaDocSearch.vue +++ b/src/runtime/components/AlgoliaDocSearch.vue @@ -150,7 +150,7 @@ const importDocSearchAtRuntime = async (): Promise => { // @ts-ignore import(/* webpackChunkName: "docsearch" */ '@docsearch/js'), // @ts-ignore - process.client && import(/* webpackChunkName: "docsearch" */ '@docsearch/css') + import.meta.client && import(/* webpackChunkName: "docsearch" */ '@docsearch/css') ]) return docsearch.default @@ -246,7 +246,7 @@ onMounted(async () => { await initialize() }) -if (process.client) { +if (import.meta.client) { watch(props, async () => { await initialize() }) diff --git a/src/runtime/composables/useAlgoliaSearch.ts b/src/runtime/composables/useAlgoliaSearch.ts index e915bf1..03dab9c 100644 --- a/src/runtime/composables/useAlgoliaSearch.ts +++ b/src/runtime/composables/useAlgoliaSearch.ts @@ -25,7 +25,7 @@ export function useAlgoliaSearch (indexName?: string) { const result = useState(`${index}-search-result`, () => null) const search = async ({ query, requestOptions }: SearchParams) => { - if (process.server) { + if (import.meta.server) { const nuxtApp = useNuxtApp() if (config.public.algolia.useFetch) { nuxtApp.$algolia.transporter.requester = (await import("@algolia/requester-fetch").then((lib) => lib.default || lib)).createFetchRequester(); diff --git a/src/runtime/composables/useAsyncAlgoliaSearch.ts b/src/runtime/composables/useAsyncAlgoliaSearch.ts index 61c0829..23dbdc5 100644 --- a/src/runtime/composables/useAsyncAlgoliaSearch.ts +++ b/src/runtime/composables/useAsyncAlgoliaSearch.ts @@ -14,7 +14,7 @@ export async function useAsyncAlgoliaSearch ({ query, requestOptions, indexName, const algoliaIndex = useAlgoliaInitIndex(index) const result = await useAsyncData(`${index}-async-search-result-${key ?? ''}`, async () => { - if (process.server) { + if (import.meta.server) { const nuxtApp = useNuxtApp() if (config.public.algolia.useFetch) { nuxtApp.$algolia.transporter.requester = (await import('@algolia/requester-fetch').then((lib) => lib.default || lib)).createFetchRequester();