The Nuxt Plugin Object Syntax - Wins for Perf, DX and Logic!

preview_player
Показать описание
💻 Nuxt plugins might not be new for the most of you - but when creating them you probably use a function á la defineNuxtPlugin(function() {...}), or the arrow function equivalent. Even though there is a *new* syntax that you can use, which is not only "backwards"-compatible but also offers more features along the way.

Key points:
🎛️ Compare the function and object syntax for Nuxt plugins
👩‍💻 Taking a deep look inside the source code
✨ Learn about new features, for example dependsOn and parallel

---

Links:

Don't forget to hit that "Subscribe" button, ring the notification bell and give a thumbs up!

🌐 Connect further:

Chapters:
00:00 Intro
1:03 Looking into the demo app
3:02 Let's see if it works!
3:25 Why we see an error
3:55 Possible fixes
4:55 Diving into the object syntax & finding a fix
6:25 Defining a name and use dependsOn and solving the problem
8:00 One more for performance with parallel
9:36 What Nuxt 4 might bring us
10:30 The env property
10:52 One last thing - The enforce option
12:35 Summary

Keywords:
defineNuxtPlugin nuxt plugin object syntax
Рекомендации по теме
Комментарии
Автор

Are you planning to use the object syntax now? 👀

TheAlexLichter
Автор

Thank you so much for providing such amazing content ❤.

The developer experience of Nuxt is unparalleled. Every aspect of the framework's API is engineered with great care, and even better, these improvements come with free performance boosts.

A huge thank you to Daniel and all other contributors for creating such an incredible framework.

Please keep the regular uploads coming 🤘.

Saeid-Za
Автор

Thanks mate for your great job, keep it up

AlexZhlobnytski
Автор

not only well versed and smart, but also handsome!

wat_question_mark
Автор

Great video again! :)
Can you make a video comparing building a package vs a Nuxt module

tiagog
Автор

Why should I define some functions as a plugin (like the $api) instead of importing it explicitly?

lassdasi
Автор

Хорош 👍
Твои видео уже нужно в документацию Nuxt включать.

виртуоз_ру
Автор

Please show nuxt api interseptor (look like vue axios interseptor)

fikreteliyev
Автор

Some times i just hate those auto load magic because as rule it completely different between frameworks and so you always have to learn all those things from scratch.

Ayvengo
Автор

Is it a good practice if i were to intiate db connection via plugin server so that it can be used throughout the apps ? Thanks

mnmb
Автор

could you speak about lots of visits and how to deploy the thing without the corps ? thks you if you do

dlef
Автор

my $api isn't being typed by Nuxt, so while it IS present on the NuxtApp it isn't including in the type definition and appears as "unknown"

wolfphantom