-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support Nuxt 3 and Bridge (wip) #396
feat: support Nuxt 3 and Bridge (wip) #396
Conversation
I would go first with Nuxt 3 support without bridge to iterate faster @nozomuikuta Thank you so much for you help ❤️ |
For now, it should be safe to augment from declare module '#app' {
interface NuxtAppCompat {
// ...
}
} I would suggest exposing a If all that is exposed is dayjs itself, we could likely also just expose it as an auto-imported composable rather than inject it globally. |
Thank you for the feedback! I will check out how core modules do auto-importing composables. 🙋♀️ I used injection just to provide the same DX as the current version. But, yeah, now it's time to move to composables with optional plug-in injection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
I'm looking forward to completing my pull request ;)
It appears as if the project is being rebuilt from scratch. Also, from a review point of view, please only address Nuxt3 in this pull request, and do the introduction of Vitest, etc. in other pull requests. I hope that you will not rework the project at your own discretion, but will correctly revise the code base so far! thank you! |
Yes, of course I will restore the existing code base before I make this PR ready for review. I created this draft PR mainly to notify people that "I'm working on Nuxt 3 support", which I think is better rather than silent development. As for testing, I didn't plan migration to Vitest just because I want to use it. I did because I found Nuxt core modules are tested with Vitest and the new Test Utils, which they announced to release soon. In addition, I was not sure the current version of Nuxt Test Utils works with Nuxt 3, so I felt like waiting for the new Test Utils if releasing Nuxt-3-compatible DayJS module is not urgent. Otherwise, if the current version of Nuxt Test Utils doesn't work with Nuxt 3, we have to release this module only with manual testing in Anyway, at least I agree that I should have separated tasks for Nuxt 3 and Nuxt Bridge. Here, I would like to know situation of and your thoughts on Nuxt 3 support.
|
Yes, the new version of nuxt test utils is working, assuming we're happy to update the test implementation as things develop. (Things might change somewhat in the API.) 👍 Here is a very basic example: nuxt-modules/harlem#8. |
Thank you for the information! |
I have created nuxt/nuxt#11772 to continue discussion and clarify where we should go. |
I'm sorry for inconvenience, but I have come to have to handle my personal stuff. I hope administrators/maintainers could reopen and take it over, or someone else could submit another PR for further development. Thank you for taking your time and posting feedback and advice for this PR. 🙇♂️ |
Resolves nuxt/nuxt#11030
Resolves nuxt/framework#387
TODOs
dayjs.config.mjs
)locales
optiondefaultLocale
optionplugins
optiondefaultTimeZone
optionHelp Wanted: Plugin Typings for Nuxt Bridge
While plugins for Nuxt 3 defined by
defineNuxtPlugin()
are perfectly type-safe, Nuxt Bridge doesn't because it uses traditionalexport default function ()
style.So, I added the reference to the code below to
.nuxt/nuxt.d.ts
viaprepare:types
hook.With the code above, I confirmed
$dayjs
is inferred:However, the type is not inferred in
setup
script:If I'm correct,
useNuxtApp()
returns an object of typeNuxtAppCompat
, and I can't add a type to it because this is not exported from Nuxt Bridge. Am I missing something?(ref. original message posted to Discord)
@pi0 @atinux @danielroe
Let me mention you guys for help, because you are definitely best at Nuxt development. 🙏