They Just Fixed VUE ROUTER

Поділитися
Вставка
  • Опубліковано 17 лип 2023
  • RESOURCES
    untyped-vue-router docs - github.com/posva/unplugin-vue...
    vite-plugin-pages - github.com/hannoeru/vite-plug...
    ✅ 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 Рік тому +37

    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

  • @notkamui9749
    @notkamui9749 Рік тому +14

    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  Рік тому +3

      i've been thinking about this too...i wonder if that's going to start to be something we see more of.

  • @MrIqbalTawakkal
    @MrIqbalTawakkal Рік тому +7

    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 Рік тому +28

    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 Рік тому +1

      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..

  • @ZyncInteractive
    @ZyncInteractive Рік тому

    Such a great addition! Soo good to see you back making videos again too.

  • @ehutch79
    @ehutch79 Рік тому +28

    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  Рік тому +6

      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 Рік тому +2

      @@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 Рік тому +1

      @@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 Рік тому +3

      ​​@@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

  • @pavelino17
    @pavelino17 Рік тому +1

    Your videos are always amazing, short, concise and full of practical knowledge

  • @MagareLosho
    @MagareLosho Рік тому +1

    How do you use the same component for different routes? Wrappers?

  • @slava_trushkin
    @slava_trushkin Рік тому +2

    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  Рік тому +2

      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 Рік тому +3

    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  Рік тому +3

      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.

  • @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

  • @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  Рік тому +1

      thanks for watching!

  • @salahiddinediouri280
    @salahiddinediouri280 Рік тому

    This is really really great , useful , thank you for sharing it and thank you for your great video/content

  • @olatunjiolakunle6908
    @olatunjiolakunle6908 Рік тому +2

    Always a banger as usual, thank you learnvue for the info.

  • @faridnugraha1266
    @faridnugraha1266 3 місяці тому

    How to use meta option route if use this plugin?

  • @korigamik
    @korigamik Рік тому

    What is your editor theme?

  • @caiovinicius2718
    @caiovinicius2718 Рік тому +1

    Ty for the video! Very good news!

  • @mikopiko
    @mikopiko Рік тому +2

    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 Рік тому +2

      SSR
      TS support
      Dev tools
      The experience is just better

    • @LearnVue
      @LearnVue  Рік тому +3

      i might have to make a full video on this.

    • @mikopiko
      @mikopiko Рік тому +2

      @@LearnVue Yes please

    • @mikopiko
      @mikopiko Рік тому +1

      @@danielochoja8507 Thanks, so my assumption was correct?

    • @AngelHdzMultimedia
      @AngelHdzMultimedia Рік тому +1

      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.

  • @allan_archie
    @allan_archie Рік тому +3

    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.

  • @matthewpulls441
    @matthewpulls441 11 місяців тому

    Anyone else getting Cannot find module 'vue-router/auto'

  • @mathnewph
    @mathnewph Рік тому +1

    What i love about current usage is using the name of the route so i don't Care what's the URL is

  • @milos018
    @milos018 Рік тому +2

    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.

  • @calimio6
    @calimio6 Рік тому

    Dynamic import seems like a better solution. I've never been a fan file base routing

  • @danteDeveloper
    @danteDeveloper Рік тому +2

    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

  • @desdev0l
    @desdev0l Рік тому +1

    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

  • @gluten2537
    @gluten2537 Рік тому

    how about layouts ?

    • @AngelHdzMultimedia
      @AngelHdzMultimedia Рік тому +1

      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 Рік тому +1

      @@AngelHdzMultimedia thanks

  • @Dragon-Slay3r
    @Dragon-Slay3r 9 місяців тому +1

    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 😂

  • @kamal_balayev
    @kamal_balayev Рік тому

    Yeeehaaaa :D :D :D

  • @ibnu7942
    @ibnu7942 Рік тому +2

    i use Ziggy because fullstack 😭

    • @LearnVue
      @LearnVue  Рік тому +3

      any reason for that over nuxt?

  • @yossefalatter2160
    @yossefalatter2160 10 місяців тому

    vue-router/auto give me an error

  • @EdwardDev
    @EdwardDev Рік тому

    This looks amazing BUT use special characters on filenames is not good idea in my opinion.

  • @justafreak15able
    @justafreak15able Рік тому

    WTH I am never leaving the vue space.

  • @ZeldriFR
    @ZeldriFR Рік тому +5

    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

  • @hansmaulwurf9051
    @hansmaulwurf9051 Рік тому +1

    If you really hate someone, teach them to recognize bad kerning

  • @ricko13
    @ricko13 Рік тому +2

    nuxt who?

  • @mrleblanc
    @mrleblanc 7 місяців тому

    Nuxt can be used for client-side rendered app too 🤦‍♂️ Why do people keep using that excuse...

  • @DominikGanic
    @DominikGanic Рік тому +2

    Cool. But I‘ll stick to vite-plugin-pages. See no big reason to switch now..

    • @LearnVue
      @LearnVue  Рік тому +3

      i like both, but the typed routes are pretty helpful imo

  • @virgiliustancu9293
    @virgiliustancu9293 Рік тому +3

    No, thanks.... don't think is an advancement.

  • @johnysmrz
    @johnysmrz Рік тому +1

    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 :/

  • @chikenmacnugget
    @chikenmacnugget Рік тому +4

    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...

  • @AIZEN155
    @AIZEN155 11 місяців тому +1

    Just use N....

  • @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)