Issue with module augmentation seems to be happening again
Environment
- Operating System: Linux
- Node Version: v20.13.1
- Nuxt Version: 3.12.2
- CLI Version: 3.12.0
- Nitro Version: 2.9.6
- Package Manager: [email protected]
- Builder: -
- User Config: -
- Runtime Modules: -
- Build Modules: -
Reproduction
You can simply clone this repository, open in VS code and navigate to playground-authjs/pages/index.vue and mouse over on auth key. The type is not correctly augmented.
Describe the bug
The MiddlewareMeta is not recognized by definePageMeta macro. This issue happened in the past and it is happening to me now.
The modification that was made here does fix the issue: #397 but it was rolled back by @danielroe here #582
I have this issue on other modules as well and augmenting from #app/../pages/runtime/composables does work.
@danielroe, do you mind trying again the latest version of this repo?
using #app
using #app/../pages/runtime/composables
Additional context
No response
Logs
No response
It would be a good idea to add a type test to this repo if this is occurring, to ensure it doesn't happen in future.
I suspect the issue is that rightly or wrongly we are augmenting it in Nuxt like this:
https://github.com/nuxt/framework/pull/2858/files#diff-df395205486536ffc90235a4d30334e7d53ea5519d778996ac209cdc5e26a53dR106
I can investigate whether we can update this in Nuxt to augment PageMeta from #app instead. Would you provide a minimal reproduction outside of this repo (without using sidebase auth), and raise it in https://github.com/nuxt/nuxt directly? 🙏
@danielroe I will open a repro, thank you.
Hi @trc-mathieu
Thanks for (re) opening an issue for this! I would love to follow along with the issue created in the Nuxt repo and then follow-up and fix the issue in our module based on the outcome.
Otherwise, we can always revert the change to ensure the types work correctly again, but I would propose to wait a bit and see if any news happen 🤗
Let's wait for Nuxt 3.12.5 and do a version bump to close the issue
This should no longer be a problem due to module using addTypeTemplate. This helper handles references correctly.
https://github.com/sidebase/nuxt-auth/blob/4b3a5904c9e0d3bce6a6334bf4a463d4835d4a48/src/module.ts#L184-L185