- 57
- 347 007
Alexander Lichter
Netherlands
เข้าร่วมเมื่อ 26 พ.ย. 2013
Web Engineering Consultant, Managing Director and Nuxt.js team member
Nuxt Build or Nuxt Generate?
When creating a Nuxt application, it seems that there are two commands in your package.json to build your application for production: `nuxt build` and `nuxt generate`. Some of you might wonder why there are two commands, what the difference of both are and when to use which one? And that's exactly what you'll find out in less than 15 minutes - in this video 🔥
#nuxt #vue #webdevelopment
---
Links and Resources:
🔗 10% Off for vuejs.de Conf with Code LICHTER conf.vuejs.de/tickets/?voucher=LICHTER
📺 Route Rules in Nuxt th-cam.com/video/Fp04Kw4nBE8/w-d-xo.html
📺 @DejaVueFm #E025 - Nuxt Modules and Open Source at work (with Lucie Haberer) share.transistor.fm/s/03e4a8a7
---
Chaptermarks
00:00 Intro
00:52 Demo Application Setup
02:16 Running in dev mode
02:54 Building with nuxt generate
04:03 Serving the generated files
04:36 Verdict of nuxt generate
06:34 Pre-rendering more routes
09:57 What if you want a more hybrid mode (SPOILER: Use nuxt build)?
11:02 Checking the output of nuxt build
11:28 Running the built application
13:43 Which command should you use?
14:18 Wrapping up
#nuxt #vue #webdevelopment
---
Links and Resources:
🔗 10% Off for vuejs.de Conf with Code LICHTER conf.vuejs.de/tickets/?voucher=LICHTER
📺 Route Rules in Nuxt th-cam.com/video/Fp04Kw4nBE8/w-d-xo.html
📺 @DejaVueFm #E025 - Nuxt Modules and Open Source at work (with Lucie Haberer) share.transistor.fm/s/03e4a8a7
---
Chaptermarks
00:00 Intro
00:52 Demo Application Setup
02:16 Running in dev mode
02:54 Building with nuxt generate
04:03 Serving the generated files
04:36 Verdict of nuxt generate
06:34 Pre-rendering more routes
09:57 What if you want a more hybrid mode (SPOILER: Use nuxt build)?
11:02 Checking the output of nuxt build
11:28 Running the built application
13:43 Which command should you use?
14:18 Wrapping up
มุมมอง: 1
วีดีโอ
Is Vue the fastest when it comes to SSR?
มุมมอง 4.4K14 ชั่วโมงที่ผ่านมา
The "SSR showdown" benchmark was heavily discussed in the last ten days. In this video, we have a look at the first and the final iteration of the benchmark, issues, results and most importantly - what the results mean for YOU as a developer. Tune in! Links and Resources: 🔗 The updated benchmark post blog.platformatic.dev/ssr-performance-showdown 🔗 The first iteration web.archive.org/web/202408...
Loading Third Party Assets with Nuxt Scripts
มุมมอง 2.6Kวันที่ผ่านมา
Almost every app built loads third party scripts - no matter if it is about analytics, consent management, chat widgets or a TH-cam embed. But third party assets pose various issues, from privacy concerns (hi GDPR) to performance impacts. Luckily, there is a new module to solve these issues! Let's take a look at nuxt/scripts in this video. #nuxt #performance #webdev Links and Resources: 🔗 10% O...
What is BFF?! (With Nuxt, Nitro and h3)
มุมมอง 6K14 วันที่ผ่านมา
🔗 10$ off for Michael's Nuxt Tips Collection with the following link and code DEJAVUE michaelnthiessen.com/nuxt-tips-collection?aff=plY9z * 🔗 10% off for vuejs.de Conf with Code LICHTER conf.vuejs.de/tickets/?voucher=LICHTER * Links and Resources: 🔗 Code TODO 🔗 h3 h3.unjs.io/ 🔗 unstorage unstorage.unjs.io/ 🔗 Nitro nitro.unjs.io/ 📺 @DejaVueFm #E022 - Signals th-cam.com/video/uqxgoeTtloA/w-d-xo.h...
Nuxt with OTHER backend frameworks?
มุมมอง 4.1K21 วันที่ผ่านมา
Nuxt and Nitro are dream team. But throughout the time, many people wondered if you could use Nuxt also with another backend framework - without using a separate instance of course (as that works anyway). So, why not giving it a try? In this video, we try to get three different backend frameworks up and running, from classic (but old) express, fastify over to "bleeding-edge" Hono. #nuxt #vue Li...
Are Front-end frameworks a security vulnerability by default?
มุมมอง 3.5Kหลายเดือนก่อน
When building modern web applications, more and more people utilize front-end frameworks like Vue or React and their meta framework equivalents, namely Nuxt, Next, Sveltekit, Remix and others. But do these frameworks bring inherent security risks? We will have a look at that in this video! - More info like chapter marks coming later on 👀
Redirects in Nuxt 3
มุมมอง 2.7Kหลายเดือนก่อน
Redirects are essential for web applications, at least at some point when a migration has to happen or SEO should be improved by having more descriptive URLs. #nuxt #vue Links and Resources: 🔗 10% Off for vuejs.de Conf with Code LICHTER conf.vuejs.de/tickets/?voucher=LICHTER 🔗 Code github.com/manniL/alexander-lichter-nuxt-3-redirect-module-diy 📺 @DejaVueFm #E019 - Nuxt Tips you Have to Know th-...
Caching in Nitro 💾
มุมมอง 3Kหลายเดือนก่อน
Caching in Nitro is one of its key aspects. In this video, we have a look at how to achieve caching in your Nitro-based application. Also works in Nuxt! #nitro #nuxt #vue Links and Resources: 🔗 10% Off for vuejs.de Conf with Code LICHTER conf.vuejs.de/tickets/?voucher=LICHTER 📺 @DejaVueFm #E018 - Insights from the Nuxt Team Retreat Chaptermarks: 00:00 Intro 00:11 What is Nitro special about 00:...
Route Rules in Nuxt - SSR, SSG, ISR and more
มุมมอง 3.2Kหลายเดือนก่อน
Nuxt supports "Hybrid Rendering" - a technique to mix various rendering modes in a single application. From the dashboard behind a login as SPA without SSR, over to caching and even prerendering pages, a lot is possible. Like... removing JS alltogether 😲 Watch the video and figure out how to set things up, how route rules work and which are available #nuxt #vue Links and Resources: 🔗 10% Off fo...
We have to talk about Rendering Modes...
มุมมอง 3.5K2 หลายเดือนก่อน
Nowadays everyone talks about "SSR" - but do people *actually* talk about the same rendering mode there? Or is it what they actually want or need? Same applies to all the other acronyms, from ISR over to SSG. And especially when talking with people not using a JavaScript Meta Framework, these terminologies might get a somewhat new meaning. Check out the video to make sure you have the overview ...
Compatibility Date in Nuxt 4 and Nitro
มุมมอง 3.3K2 หลายเดือนก่อน
📅 Huh? Were you also asked to provide a "compatibilityDate" when upgrading to Nuxt 3.12 or later? And also wondered what it is about? Then fret no more! In this video, the whole concept behind compatibilityDate will be explained - why it is necessary, if you should set it already and how providers play a role! Key points: ✨ Why was compatibility date introduced? ⚙️ What does it change for me? ‼...
Patching Packages - The ULTIMATE Guide
มุมมอง 2.3K2 หลายเดือนก่อน
🩹 Found a bug in a package and want to fix it locally? Waiting for a fix that wasn't released yet? Don't worry, you can apply all these locally to the packages in your node_modules. In this video, a guide for all major package managers showcases how you can patch your packages locally, why "doing it manually" is not a good idea and which consequences local patches might have. Worth watching for...
NEW Folder Structure in Nuxt 4
มุมมอง 14K2 หลายเดือนก่อน
📂Nuxt's folder structure is well-known to everyone using the meta framework. But in Nuxt 4, it will be slightly changed. In this video, you'll learn how the change looks like, why the team decided to change the structure and how to easily migrate over. So easy, that it'll be done in just a couple of minutes Don't believe me? Then tune in now! 👀 Key points: 4️⃣ Why the new folder structure? ✨ Ho...
Dynamic Rendering in 2024 - SSR only for Crawlers?
มุมมอง 2.8K2 หลายเดือนก่อน
🔍️ SEO is crucial for public-facing applications, resulting in the need of SSR for modern SPAs. But, why not enable SSR only for crawlers so they can get all the data while the users see a plain SPA? This approach is called "Dynamic Rendering"! If this is a good idea, what Google thinks about it and whether you should use it or not will be answered in this video! #ssr #dynamic rendering Links 🔗...
Composition API vs. Options API - One API to Rule Them All?!
มุมมอง 4.3K3 หลายเดือนก่อน
💪 This week was a lot of discussion about the two Vue APIs - the Composition and the Options API - on Social Media. Thus, I took some time to assess the shared thoughts discussions and also went a step further: I asked you why you prefer the Options API and wanted to figure out pain points you have with the Composition API. The results are all distilled in this video, including what the Vue tea...
Adding a new nuxt.com logo with useCookie and routing
มุมมอง 3K3 หลายเดือนก่อน
Adding a new nuxt.com logo with useCookie and routing
Store files and K/Vs in Nuxt and Nitro - Powered by unstorage
มุมมอง 3.8K4 หลายเดือนก่อน
Store files and K/Vs in Nuxt and Nitro - Powered by unstorage
Stream VOD #006 - Building an Association Manager with Nuxt.js
มุมมอง 3.3K4 หลายเดือนก่อน
Stream VOD #006 - Building an Association Manager with Nuxt.js
Nuxt Instance Unavailable - Async Code in Vue and Nuxt with the Composition API (+ raffle 🎁)
มุมมอง 4K4 หลายเดือนก่อน
Nuxt Instance Unavailable - Async Code in Vue and Nuxt with the Composition API ( raffle 🎁)
Nuxt Test Utils - A Primer to Testing in Nuxt
มุมมอง 8K5 หลายเดือนก่อน
Nuxt Test Utils - A Primer to Testing in Nuxt
How to use Nuxt Layers to encapsulate your code
มุมมอง 9K5 หลายเดือนก่อน
How to use Nuxt Layers to encapsulate your code
Integrating WebSockets in Nuxt and Nitro
มุมมอง 7K5 หลายเดือนก่อน
Integrating WebSockets in Nuxt and Nitro
😲 An environment-aware Nuxt Configuration
มุมมอง 6K6 หลายเดือนก่อน
😲 An environment-aware Nuxt Configuration
Avoid losing Reactivity in your Vue Application
มุมมอง 7K6 หลายเดือนก่อน
Avoid losing Reactivity in your Vue Application
Nuxt APIs get more and more confusing. I am switching back to barebones Vue.
What is confusing for you there? 🤔
lol, I was just searching for it.
What a timing 🤗
Nice video, thank you! :) But how can you see the API call in the network tab, aren't they happening server side?
They don’t if you do a client navigation 👀
Can we use a .env with runtimeConfig ? What is the best practice?
Yes absolutely! It just have to be read in by you when starting the app „manually“.
Great content, thank you!
You are welcome 🤗
I would like to thank you for your great efforts, i really learned a lot, I have a question regarding setting the "authorization" token in the requests header, - should i store the token on the localStorage and use it from there? or - should i use HTTP only cookies ? what could be better and more secure ?
im making a vue widget in vite which builds a js script, and i want to use it in a nuxt project, but whenever i import the script the HMR on the nuxt app stops working... any hints why this may be? is it maybe because Vue from the script is somehow interfeering with Vue from Nuxt? also if you have any tips for creating widgets in vue, that would be great!
IMPORTANT: This feature is now an experimental flag that is built into Nuxt. See nuxt.com/docs/guide/going-further/experimental-features#buildcache for more.
Thank you!
You're welcome!
wowowow bro you are a gem its solved alot of issues of my vue app :) where were you thanks for the tip
Glad you found this channel 🙏🏻
Thanks for the amazing video! I have a two questions: - If my API endpoint returns all the information possible because it's a general endpoint designed to be used with multiple clients, even if I use BFF, that doesn't mean the speed of the page will increase because the endpoint will be slower due to the need of fetching more data from the database, then transforming it and transfering it via the network. So, how do we improve the speed via BFF? - If the data changes quite often, caching won't be possible, so we can't benefit from it. Maybe a different caching strategy must be applied? Thank you!
You are welcome! 1) It can still be faster if you actually cache the data (if possible). Otherwise, there might be a slight overhead because you do another request, yes. You can then decide to simply proxy your API endpoint (th-cam.com/video/J4E5uYz5AY8/w-d-xo.html) 2) You might be able to partially cache data then, e.g. the one not changing, or use a lower cache duration. If the data isn't cacheable at all (e.g. changing too fast), then you might not be able to cache the data if you need it in "real time".
@@TheAlexLichter Thank you very much. The partial cache is a good idea. I didn't think about that. And thak you very much again for the tutorial!
@handmasters sure thing! Thanks for your question 🙏🏻
Alex, thank you for the helpful videos on working with Nuxt! Could you please help a beginner? How can I pass cookies with proxyRequest? There are no issues on the client side, but for server-side requests, it seems like cookies are not being passed.
wow this is great. Thank you so much for creating the content.
Of course! You are welcome 🤗
too much words
I like svelte very much, but I don't like the ecosystem. Which makes me quite hesitent to transition to vue. They are similar but vue has bigger ecosystem.
Svelte and Vue have quite similar ideas here and here. Definitely give Vue and Nuxt a try! 🔥
I don't use vue in my current projects, but if Vue is like it was in the past it is better than Svelte because you can compile components and reuse them more easily than Svelte
@@andreilucasgoncalves1416 What do you currently use and why? Honestly, I looked into nuxt a bit, it handles most things much better than sveltekit, which makes me more likely to migrate to nuxt. I espcially like the dev tools, file structure, the auto-imports. All of which are great pain in sveltekit.
I don't usually comment on videos but this one was hugely helpful in trying to get my site more performant. That inline script trick for handling, in my case, the prefers-color-scheme setting for the user so that I don't have a flash of light/dark theme as the page loads was mint 👌
Vue / Nuxt has been a high performer for so many years and too modest / quiet on this front I feel. Interesting also is ‘# years in pole position’. I feel as one of the first truely Open Source front end libraries, not enough credit is given to the little guy vs Major corps (or the people who have helped them). (I would add, Open Source, as a collective seems to be winning the day).
Good video recap Andrew. Vue + Nuxt FTW 🏔⛰
Vue and React are libraries not frameworks. Next and Nuxt are actual frameworks. Would like to see comparison between the frameworks.
I really enjoy using Vue JS and Nuxt JS in my projects and as a Turkish developer, I follow the developments closely.
I missed a heartbeat when you said scoped styles are problematic 😱
When I researched and read into it I was also shocked at first 🙈
@@TheAlexLichter I would actually really love a video about Nuxt and styles :) Scoped vs unscoped? Any performance difference? Vanilla styles, vs less/sass/stylus? Importing into a style tag (import, @use etc). Is the content of a style tag always inlined in the end or are we sometimes adding css files that need to be referenced? Do style tags work exactly the same when added to components, pages, layouts or app files? Render blocking issues and performance in general for styles. Style tag vs utility class frameworks?
@leopoldkristjansson there are 1-2 issues in Nuxt that should be fixed beforehand with regards to that but I agree! Added on the list
Hey Alexander, i have a couple of nuxt projects and i want to make a BFF from one nuxt app and use it in the other nuxt apps, but there is a problem... i lose the type safety in the other apps, i have to manually create the types... is there some way i can import the types in the other nuxt projects? or is there a plan to implement something like codegen/openapi for the types? having the types in useFetch in other projects would be ideal! any help with this is much appreciated! Thanks!
If it is a monorepo, it should be straightforward. If there are different repos, you can use Nitro's OpenAPI option to generate the types 👌🏻
@@TheAlexLichter where can i find the docs for the Nitro's OpenAPI option?
@ivanangelkoski nitro.unjs.io/config#openapi
@@TheAlexLichter Thank You Sir!
i can't find an example of how to add the query or params to the description for the open api. can you provide a simple snippet how can i implement for example pagination queries and params? for example if im on the route api/posts?limit=10&skip=10 , how can i make skip and limit show up in open api? also for example if im on route api/post/[id], how can i add the id param?
I just switched fully to Vue / Nuxt after many many years of React and next. While I truly love the JSX used in React and the way how you write components, I had so many headaches over the past years duo to weird behavior which came mostly from hooks. And I don't like the fact that state management is still not as great as in other frameworks. The switch felt so smooth and honestly I'm thinking now why this took me so many years. I heard from friends and colleagues that Vue is great, but never had the motivation for it but oh boy was I stupid. Using nuxt now daily for two months and I hadn't any impediments or so and I'm enjoying it so far.
We used Nuxt for building an LXP (Entreprise-level education and online training platform for employees), consisting of three Nuxt front-ends connected with an SSO. Nuxt is amazing!! thank you for your amazing work.
Vue es el mejor❤, svelte como siempre con su versión 5 beta en todos las comparativas, su versión estable es la 4
amazing, vue is best!
Just so you know … nuxt and vue could’ve been last and I’d still choose them
Me too
HTMX is the fastest of them all. :D
Especially when it comes to SSR 🫠 (HTMX can’t do “SSR” the way React, Vue, Svelte etc can)
Nuxt has been a pleasure to use at an enterprise level
Really glad to hear that! What did you build with it?
Yes, but there is a nuance)))
There is indeed!
Hey Alex! as always a great video <3 wanted to ask How would you approach to get an event bus in Nuxt. Recently I faced a usual situation where I wanted to listen to emit from a component in any part of my application, but didn't want to install dependencies like mitt
Thank you ☺️ I personally am not a big fan of the pattern due its shortcomings compared to eg a pinia store or composable. What would you use it for?
@@TheAlexLichter I would use it for to trigger any side effects in another part of my application like recalculate stocks when user sets nearby store address but in certain pages. Would love to hear your suggestion and is the $emit with its name available under global nuxt instance??
@@bishal_mishra99 I think pinia store should suffice your requirement
@@bishal_mishra99try to avoid using too many emits. Pinia or a simple composable with shared state is probably the better way. I also wouldn’t really call it an event bus, as that has a very different meaning in the data science world😉
@@gro967 Yes I was just curious 🧐 to see if there's a cleaner way without an extra state. Ooh, what does it mean in the DS world?
Nuxt+Vue is love 💚
💯
nuxt is love, nuxt is life
🎉🎉
✨
Interesting, can you open source the comparison you did between angular, next and nuxt? So that everyone can see the code and improve it.
Yes, as soon as the thesis is published I will!
@@TheAlexLichterNice, great video by the way.
@oussaber thanks 🙏🏻
What do you think about the results?
What about Angular SSR?
@alexanderkim7241 see the linked PR (and also the mention in the video)
I really like these kinds of 'Practical Example' videos that can be applied to real-life scenarios. I suggest making some short code review videos as well.
Thanks! I might do these on stream and release a VOD here 👌
Nice video as always but the example with title passed as props and then mutated thanks to toRef is not the best as props shouldn't be mutated.😊
Yes, that's true! Also mentioned that in the comments before. On the other hand, a `computed` is less performant (+ there is the readonly helper)
excited to see nuxt 4
Can't wait either! And so many pieces are already available 🙌
First of all thanks for the content. Considering the best practice url proxy method which uses a catch-all route in server/api/ path, how does these 2 play together? Also since a catch-all server route can transform all outgoing requests, is moving general logic like authentication headers to this same route viable?
Laravel Mentioned.
This content is so informative and did solve my problems !!! Thanks a lot
You are welcome 👌
this guy needs to learn how to talk slowly, like its funckin annoying,
"This guy" suggests 0.5x speed then 😁
how can i use runtimeConfig outside of nuxt app? For example i have a couple of services that rely on the .env and they are outside vue component/composable, but i can only use useRuntimeConfig inside of a component or composable… is there a solution for this? Or any recomended approach.. Thank you!
Not really, you can’t directly. It needs the context of Nuxt/Nitro You could pass the values when calling the fn/service, eg in a plugin or on demand
@@TheAlexLichter got it, thanks for the reply! also is there any downside in using the .env variables directly in the service? example: const service = new Service(process.env.MY_VAR)
Mainly that you won't be able to change them at runtime (only during build)
Great video! Saved me a lot of time, scrolling through the github comments, trying everything on my own! More of that! :D
@TheAlexLichter Is there a way to get all caches in a Nitro/Nuxt app? My use case is that I would like to build an admin interface, where you can invalidate caches :)
You certainly can. NuxtHub is also doing that 👌🏻
Got here thorugh the link in Nuxt official docs. Great work!
Thank you 🙏🏻
thanks bro
Sure thing 👌🏻
Would calling load function multiple times have any side effects? Or would it be just a NOOP ? I used to manually store the now deprecated $script promise and would return if fhe script was not loaded yet, to prevent duplicate loading of script. Would this new approach suffice this kind of use case? Thanks for the video! ❤
I'll look but my first question is can the utils folder have nested folders to organize my api's and still benefit from auto-imports in the server andpoints??
You'd have to add them to your auto imports then but yes, that works See th-cam.com/video/FT2LQJ2NvVI/w-d-xo.html
That's nice! But lets take Hotjar as an example. There is a Hotjar Nuxt Module available. Should I rather use useScript or the available module? Do Nuxt modules (usually) use useScript under the hood?
As Nuxt Scripts is rather new, most modules won't support Nuxt Scripts at the time of writing. I see two ways there though: 1) If the module is doing not much on top besides configuration + loading the script, a nuxt/scripts registry script would be the way to go and the module wouldn't be needed 2) If the module does more beyond that (think of e.g. setting up a custom configuration, adding plugins and so on), then the module should use Nuxt/Scripts at some point 👍