diff --git a/package.json b/package.json index 400cc8b..377e6a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nuxtjs/algolia", - "version": "1.1.0", + "version": "1.1.1", "description": "Algolia module for Nuxt", "repository": { "type": "git", @@ -54,10 +54,6 @@ "publishConfig": { "access": "public" }, - "bugs": { - "url": "https://github.com/nuxt-community/algolia-module/issues" - }, - "homepage": "https://github.com/nuxt-community/algolia-module#readme", "directories": { "doc": "docs", "example": "playground" diff --git a/src/module.ts b/src/module.ts index ef127ee..6569661 100644 --- a/src/module.ts +++ b/src/module.ts @@ -121,15 +121,29 @@ export default defineNuxtModule({ }) } - nuxt.options.runtimeConfig.public.algolia = defu(nuxt.options.runtimeConfig.public.algolia, { - apiKey: options.apiKey, - applicationId: options.applicationId, - lite: options.lite, - instantSearch: options.instantSearch, - docSearch: options.docSearch, - recommend: options.recommend, - globalIndex: options.globalIndex - }) + if (nuxt?.options?.runtimeConfig?.public?.algolia) { + // Nuxt 3 + nuxt.options.runtimeConfig.public.algolia = defu(nuxt.options.runtimeConfig.algolia, { + apiKey: options.apiKey, + applicationId: options.applicationId, + lite: options.lite, + instantSearch: options.instantSearch, + docSearch: options.docSearch, + recommend: options.recommend, + globalIndex: options.globalIndex + }); + } else { + // Nuxt 2 (Edge) + nuxt.options.publicRuntimeConfig.algolia = defu(nuxt.options.publicRuntimeConfig.algolia, { + apiKey: options.apiKey, + applicationId: options.applicationId, + lite: options.lite, + instantSearch: options.instantSearch, + docSearch: options.docSearch, + recommend: options.recommend, + globalIndex: options.globalIndex + }); + } if (options.instantSearch) { nuxt.options.build.transpile.push('vue-instantsearch/vue3')