nuxt-modules / algolia

🔎 Algolia module for Nuxt
https://algolia.nuxtjs.org/
MIT License
191 stars 35 forks source link

Fail on Nuxt 3 RC9 #91

Closed agracia-foticos closed 2 years ago

agracia-foticos commented 2 years ago

Version

@nuxtjs/algolia: 1.1.0 nuxt: 3.0.0-rc.9

Reproduction Link

We have updated Nuxt to version 3 RC 9 and it has thrown us an error. Please update module to work with RC 9

agracia-foticos commented 2 years ago

Fails the call to const { result, search } = useAlgoliaSearch('XXXXXX')

Baroshem commented 2 years ago

Hey @agracia-foticos

I am currently on holidays without access to the computer so I wont be able to release a new version with a fix. I will do that later in september when I will be back.

Also, could you please paste the error here with more descriptive info?

Lexpeartha commented 2 years ago

@Baroshem there was a breaking change introduced in nuxt rc 9, check out nuxt/framework#7116

ricky11 commented 2 years ago

This the error from vite : WARN Module FormKit is disabled due to incompatibility issues: 11:00:41

podlebar commented 2 years ago

i deploy to Vercel and this is what i get: ERROR [nuxt] [request error] [unhandled] [500] Directory import '/var/task/node_modules/vue-instantsearch/vue3/es' is not supported resolving ES modules imported from /var/task/chunks/app/server.mjs

i assume it's because of this:

autoImports:dirs hook is deprecated. Use addImportsDir() from @nuxt/kit or imports:dirs with nuxt>=3.0.0-rc.9.
Baroshem commented 2 years ago

Guys, thanks for explaining the issue. It seems that the nuxt core team released a breaking change in the nuxt kit. The fix should be relatively simple (replacing the hook) but I wont be able to release a fix version with it as I am currently on holidays. I will be back end of september and then I will release the new version to fix your issues.

monkemedia commented 2 years ago

Does anyone have a quick fix for this in the meantime?

lukaszflorczak commented 2 years ago

@monkemedia Here is my patch. You can use patch-package and add the code below to patches/@nuxtjs+algolia+1.1.1.patch file. It works for me.

diff --git a/node_modules/@nuxtjs/algolia/dist/module.json b/node_modules/@nuxtjs/algolia/dist/module.json
index 506aa8c..7b327a0 100644
--- a/node_modules/@nuxtjs/algolia/dist/module.json
+++ b/node_modules/@nuxtjs/algolia/dist/module.json
@@ -2,7 +2,7 @@
   "name": "@nuxtjs/algolia",
   "configKey": "algolia",
   "compatibility": {
-    "nuxt": "^3.0.0 || ^2.16.0",
+    "nuxt": "^3.0.0-rc.9 || ^2.16.0",
     "bridge": true
   },
   "version": "1.1.1"
diff --git a/node_modules/@nuxtjs/algolia/dist/module.mjs b/node_modules/@nuxtjs/algolia/dist/module.mjs
index e37b246..13aba7d 100644
--- a/node_modules/@nuxtjs/algolia/dist/module.mjs
+++ b/node_modules/@nuxtjs/algolia/dist/module.mjs
@@ -90,7 +90,7 @@ const module = defineNuxtModule({
     name: "@nuxtjs/algolia",
     configKey: "algolia",
     compatibility: {
-      nuxt: "^3.0.0 || ^2.16.0",
+      nuxt: "^3.0.0-rc.9 || ^2.16.0",
       bridge: true
     }
   },
monkemedia commented 2 years ago

@lukaszflorczak Once I make these changes, do I do anything else? I just re-ran npx nuxi dev and am getting the following error: Cannot destructure property 'applicationId' of '__vite_ssr_import_0__.useRuntimeConfig(...).algolia' as it is undefined.

lukaszflorczak commented 2 years ago

@monkemedia

  1. Complete the "Set-up" instruction. You have to add postinstall script in your package.json and of course install patch-package.
  2. Run again npm/yarn/pnpm install – the patch will be automatically applied after installation.
monkemedia commented 2 years ago

@lukaszflorczak thank you for the instructions. I have never used patch package before. Seem to have done everything correctly and the patch has been installed, however, I am still getting the same error Cannot destructure property 'applicationId'

monkemedia commented 2 years ago

Fixed it by following this https://github.com/nuxt-community/algolia-module/issues/84

Baroshem commented 2 years ago

Guys, the new version has been released. You can verify now if it works correctly. I have tested it in several nuxt projects and it is working correctly :)

lukaszflorczak commented 2 years ago

In my project, everything works fine (tested on rc-11). Thank you!

podlebar commented 2 years ago

works with rc9 to rc11. i upgraded my project step by step and i had no issues.

Baroshem commented 2 years ago

Closing the issue then. Thanks for the input guys!