They Just Fixed VUE ROUTER

  Рет қаралды 35,907

LearnVue

LearnVue

Күн бұрын

RESOURCES
untyped-vue-router docs - github.com/pos...
vite-plugin-pages - github.com/han...
✅ Join the LearnVue+ Waiting List - learnvue.co
Get early access to videos, exclusive content, interactive code challenges, and more.
follow me on twitter:
/ mattmaribojoc
#vuejs #vue #javascript #webdev

Пікірлер: 84
@ralacerda12
@ralacerda12 Жыл бұрын
Wow, this is INSANE. I always use Nuxt for the file based routing, but I got a new job and they are using Vue for CSR, so this is the perfect solution. Hat off to the developers and thanks for the content
@LearnVue
@LearnVue Жыл бұрын
glad it helps!
@notkamui9749
@notkamui9749 Жыл бұрын
Honestly, even for single page apps I use Nuxt now. You can setup Nuxt to statically generate your app with the `ssr: false` property, and using `nuxt generate` instead of `nuxt build`. The plugin system, autoimports, etc, are all achievable with different Vue plugins, but it's just so nice that it just works out of the box with Nuxt.
@LearnVue
@LearnVue Жыл бұрын
i've been thinking about this too...i wonder if that's going to start to be something we see more of.
@MrIqbalTawakkal
@MrIqbalTawakkal Жыл бұрын
the trade-off would be when writing guard, auth related, defining meta. because the route attribute (meta, name, etc.) is all over the place instead of in 1 file.
@sebastianderien5823
@sebastianderien5823 Жыл бұрын
I don't know. This looks quite nice if you have some simple routes. But I kinda can't imagine using this on complex routes with params and meta on large projects. I would maybe prefer the other way around an IDE add-on that generates a nice overview from a route file. Anyway thanks for the video.
@Tarabass
@Tarabass Жыл бұрын
Agree. But maybe we are not thinking straight. There are other ways to achieve things, like using a store for params and use definePage on the page component. A 404 would be also, as well as redirects. Extends will help eventually..
@ehutch79
@ehutch79 Жыл бұрын
File based routing is NOT always the appropriate answer. For more complex apps with reusable components and tabbed architectures, you likely still want whatever.routes.ts files. Being able to just pass metadata helps. It avoids writing wrapper components around a reusable component.
@LearnVue
@LearnVue Жыл бұрын
agreed that file-based routing is not always the answer. would definePage from unplugin-vue-router be enough for passing that additional data onto routes? or you thinking of something more
@ehutch79
@ehutch79 Жыл бұрын
@@LearnVue I honestly don't see the need. If I needed page based routing, I'm sure this plugin would be good. But there's nothing wrong with configuration based routing. You can do a lot more with it, and typically have more control. I get genuinely worried about people cargo culting from stuff like this, when the basic vue router will do the job.
@darialyphia
@darialyphia Жыл бұрын
@@LearnVue yes it would. with definePage you can provide anything you'd provide to a normal route declaration. You lost absolutely zero control. It's an auto include for the typed routes alone.
@heroe1486
@heroe1486 Жыл бұрын
​​@@ehutch79 mean that's not inherent to Vue router, people are using frameworks like Vue while you could all this with vanilla JS and way more, it always comes down to convenience vs control, the tricky part is finding the sweet spot
@slava_trushkin
@slava_trushkin Жыл бұрын
I was just working with Vue app that used router when you released this video. Immediately switched to unplugin-vue-router and it works perfectly. Switch was painless.
@LearnVue
@LearnVue Жыл бұрын
forgot to mention this in the video, but unplugin-vue-router is made by eduardo (vue-router/core team)...so the experience is sure to be good lol
@ojvribeiro
@ojvribeiro Жыл бұрын
@@LearnVue yeah, the great @posva
@Shulkerkiste
@Shulkerkiste Жыл бұрын
Thanks for your videos! I want to switch to TypeScript in Vue, but I don't feel comfortable yet. From what I've seen, there are multiple ways to write some TS features in Vue. In addition, the Vue team is also updating some TS features this year. That's why I'm not sure which TS features are best practice. I guess some are still in beta or might get optimized in the next months. A video would be awesome about how to properly use TypeScript in Vue (with props, emits, computed, watch, ..., all the important stuff).
@LearnVue
@LearnVue Жыл бұрын
i've been meaning too for a while - i'll see what i can come up with (that's not too long of a video)
@soviut303
@soviut303 Жыл бұрын
As it stands, Vue 3.3 typescript support is excellent. The biggest issue I can think of was the lack of generics for component props. I'm not sure what areas you've been concerned about, but typing refs, props, emits, etc. have all worked for a long time, even in the templates.
@MagareLosho
@MagareLosho Жыл бұрын
How do you use the same component for different routes? Wrappers?
@pavelino17
@pavelino17 Жыл бұрын
Your videos are always amazing, short, concise and full of practical knowledge
@ZyncInteractive
@ZyncInteractive Жыл бұрын
Such a great addition! Soo good to see you back making videos again too.
@Dragon-Slay3r
@Dragon-Slay3r 11 ай бұрын
Because the samosa crack has been removed from the v vase which previously was a real bowl wine glass Now the router bit can etch anything on any flat piece of wood 😂
@faridnugraha1266
@faridnugraha1266 5 ай бұрын
How to use meta option route if use this plugin?
@mikopiko
@mikopiko Жыл бұрын
One thing I don't understand, what does Nuxt do that Vue + Vite cannot? What's the point with Nuxt? Is it the bleedinge-edge version of Vue where they add all the good features there?
@danielochoja8507
@danielochoja8507 Жыл бұрын
SSR TS support Dev tools The experience is just better
@LearnVue
@LearnVue Жыл бұрын
i might have to make a full video on this.
@mikopiko
@mikopiko Жыл бұрын
@@LearnVue Yes please
@mikopiko
@mikopiko Жыл бұрын
@@danielochoja8507 Thanks, so my assumption was correct?
@AngelHdzMultimedia
@AngelHdzMultimedia Жыл бұрын
Nuxt was born by the need of good and type safe SSR (Server Side Rendering). I always want to go deeper into things, so I wanted to learn how SSR was made, so went into the SSR docs in both Vite and Vue pages, and ultimately understood why Nuxt was created. It was like the next logical step. Now Nuxt is also backend! You can use Nuxt as backend only, frontend only or both! I'm testing and reporting bugs the Session API (like express-session) and so far so good. Next is the authentication, authorization, strategies, etc. (it's in the roadmap). So yes, we can say Nuxt is the Vue version with all the good stuff hahaha. Long time ago I don't use pure Vue projects. It's all Nuxt now, with Quasar as UI library. With plugins we can port to desktop (electron), mobile (cordova/capacitor) (I tried it!). Quasar still don't have auto pages/layouts/components/modules importing, so we would have to install and configure all these dependencies (unplugin-vue-router, vite-plugin-vue-layouts, unplugin-auto-import, and the components one, can't remember!) but the author promises they will work on it. So in the meantime, I can't use Quasar + Vite CLI, so I use Nuxt and import Quasar as UI dependency with the aid of the nuxt-quasar-ui module.
@ZeldriFR
@ZeldriFR Жыл бұрын
Is it possible to have typesafety with routes but still use router.ts, I don't like file based router, it quickly becomes a mess with lot of routes, your editor is full of opened "index.", and it makes translations of routes basically impossible 😐
@LearnVue
@LearnVue Жыл бұрын
github.com/posva/unplugin-vue-router#typescript - it creates types at runtime so i _think_ you should be able to use extendRoutes if needed? let me know if you find something else though
@allan_archie
@allan_archie Жыл бұрын
My one and only Vue content creator. My feed is usually packed with React. Which is kinda sad because I don't even know React.
@LearnVue
@LearnVue Жыл бұрын
trying to represent for the vue community
@AngelHdzMultimedia
@AngelHdzMultimedia Жыл бұрын
@@LearnVue Thank you!!! 💚
@olatunjiolakunle6908
@olatunjiolakunle6908 Жыл бұрын
Always a banger as usual, thank you learnvue for the info.
@LearnVue
@LearnVue Жыл бұрын
you bet :)
@chaddicusthegreat
@chaddicusthegreat Жыл бұрын
This is awesome! Hey what IDE are you using?
@gabrielserejo8379
@gabrielserejo8379 Жыл бұрын
Finally! Thank you for posting, i was missing your videos
@LearnVue
@LearnVue Жыл бұрын
thanks for watching!
@mathnewph
@mathnewph Жыл бұрын
What i love about current usage is using the name of the route so i don't Care what's the URL is
@korigamik
@korigamik Жыл бұрын
What is your editor theme?
@desdev0l
@desdev0l Жыл бұрын
The syntax in file name scares me. Honestly I would personally prefer the traditional vue routing approach
@LearnVue
@LearnVue Жыл бұрын
fair enough, do you think the wildcard/param syntax in a router.ts file makes more sense?
@desdev0l
@desdev0l Жыл бұрын
@@LearnVue Yup. I think file based routing looks good until we are adding some complex syntax to it. IMO those should stay and configured in the code. Not to mention changing the file name messes with git history
@danteDeveloper
@danteDeveloper Жыл бұрын
Interesting. the cons of this approach might developer need to learn how file based config works even they don't need SSR.
@LearnVue
@LearnVue Жыл бұрын
yeah, learning either the advanced router.ts config (wildcard matchers, etc.) or the file-based naming standards
@matthewpulls441
@matthewpulls441 Жыл бұрын
Anyone else getting Cannot find module 'vue-router/auto'
@p-townhero
@p-townhero 11 ай бұрын
Yeah
@mrleblanc
@mrleblanc 9 ай бұрын
Nuxt can be used for client-side rendered app too 🤦‍♂️ Why do people keep using that excuse...
@ibnu7942
@ibnu7942 Жыл бұрын
i use Ziggy because fullstack 😭
@LearnVue
@LearnVue Жыл бұрын
any reason for that over nuxt?
@ricko13
@ricko13 Жыл бұрын
nuxt who?
@LearnVue
@LearnVue Жыл бұрын
nuxt what?
@TheDeprecatedLibrarian
@TheDeprecatedLibrarian Жыл бұрын
deez nuxt?
@justafreak15able
@justafreak15able Жыл бұрын
WTH I am never leaving the vue space.
@virgiliustancu9293
@virgiliustancu9293 Жыл бұрын
No, thanks.... don't think is an advancement.
@DominikGanic
@DominikGanic Жыл бұрын
Cool. But I‘ll stick to vite-plugin-pages. See no big reason to switch now..
@LearnVue
@LearnVue Жыл бұрын
i like both, but the typed routes are pretty helpful imo
@chikenmacnugget
@chikenmacnugget Жыл бұрын
Lol one more " WOW LOOK AT THIS AMAZING" youtuber... File based routing is only one more way to do. If you have complex app with a lot of reusable components it is not your way. And you need go to comments to get this information. Because youtubers can only "WOW" "LOOK AT THIS" "IT'S AMAZING". Nahhh IT youtube is a big trash can...
@hansmaulwurf9051
@hansmaulwurf9051 Жыл бұрын
If you really hate someone, teach them to recognize bad kerning
@milos018
@milos018 Жыл бұрын
Already mentioned that Nuxt is probably the best way to go, but if you are "stuck" with Vue only, this is a great tool. Maybe I missed it in the video, but it's important to not that unplugin-vue-router is developed by Eduardo (posva), the same person who is the creator of vue-router
@LearnVue
@LearnVue Жыл бұрын
facts, have you seen his vue.js london talk about it?
@milos018
@milos018 Жыл бұрын
@@LearnVue Yep, but had to rewatch it. Been using Nuxt for too long now to need this, but it's very useful. I am glad to be sponsoring his work and would encourage anyone else to consider it as well.
@caiovinicius2718
@caiovinicius2718 Жыл бұрын
Ty for the video! Very good news!
@LearnVue
@LearnVue Жыл бұрын
No problem!
@Danny_Front-end_Developer
@Danny_Front-end_Developer Жыл бұрын
Can you tell my if I can use this plug-in without typescript? I just started coding about 4 monts ago, front-end developer course, and I used vue router for the first time with my latest project. I don't use ts but can I still ues the new router plug-in? I think my last comment disappeared
@salahiddinediouri280
@salahiddinediouri280 Жыл бұрын
This is really really great , useful , thank you for sharing it and thank you for your great video/content
@calimio6
@calimio6 Жыл бұрын
Dynamic import seems like a better solution. I've never been a fan file base routing
@EdwardDev
@EdwardDev Жыл бұрын
This looks amazing BUT use special characters on filenames is not good idea in my opinion.
@yossefalatter2160
@yossefalatter2160 Жыл бұрын
vue-router/auto give me an error
@p-townhero
@p-townhero 11 ай бұрын
Yeah same!
@kamal_balayev
@kamal_balayev Жыл бұрын
Yeeehaaaa :D :D :D
@AIZEN155
@AIZEN155 Жыл бұрын
Just use N....
@gluten2537
@gluten2537 Жыл бұрын
how about layouts ?
@AngelHdzMultimedia
@AngelHdzMultimedia Жыл бұрын
You can use the following packages for auto layouts/pages-routes/components/modules importing: unplugin-vue-router, vite-plugin-vue-layouts, unplugin-auto-import, and the components one, can't remember! But you will quickly notice the boilerplate and energy/time spent in configuring these and finally realizing Nuxt 3 has all this built-in. :)
@gluten2537
@gluten2537 Жыл бұрын
@@AngelHdzMultimedia thanks
@johnysmrz
@johnysmrz Жыл бұрын
We get rid of file based routing circa 2006.... please don't bring that shit back!
@LearnVue
@LearnVue Жыл бұрын
i got some bad news for you :/
@RaphaelDDL
@RaphaelDDL Жыл бұрын
just use nuxt fr fr Does nuxt uses this under the hood or is that a port of what Nuxt did to 'non-nuxt' envs?
@LearnVue
@LearnVue Жыл бұрын
yup it uses it for the experimental typed pages (github.com/nuxt/nuxt/pull/20367/files)
Vue is getting EVEN FASTER?
5:21
LearnVue
Рет қаралды 15 М.
The day of the sea 😂 #shorts by Leisi Crazy
00:22
Leisi Crazy
Рет қаралды 1,7 МЛН
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
How To Get Married:   #short
00:22
Jin and Hattie
Рет қаралды 20 МЛН
Vue Router | Building single page applications
8:20
Vue Mastery
Рет қаралды 26 М.
Common Mistakes in Vue js and How to Avoid Them - Daniel Kelly
29:49
VueConf Toronto
Рет қаралды 7 М.
You're Probably Using Nuxt Wrong
5:16
LearnVue
Рет қаралды 25 М.
Master React JS in easy way
12:18
Nova Designs
Рет қаралды 94 М.
Better Rendering Performance with Virtual Lists
5:59
LearnVue
Рет қаралды 34 М.
Pinia Simplified
4:28
LearnVue
Рет қаралды 122 М.
The Most Legendary Programmers Of All Time
11:49
Aaron Jack
Рет қаралды 565 М.
Svelte UI Libraries Have Leveled Up
12:14
Huntabyte
Рет қаралды 60 М.
Stop Using .value with ref In Vue 3! Reactivity Transformed Explained!
14:22