Replies: 30 comments 80 replies
-
Related vercel/next.js#28180. We might also set UA-based rules to enable ISR/Static based on user-agent only for mobile or search engines with a simple API. (but it obviously is not supported on all edge CDNS and need a nitro hit at least once also they cannot benefit shared-cache) |
Beta Was this translation helpful? Give feedback.
-
nuxt sends here white trying to generate fully static site. |
Beta Was this translation helpful? Give feedback.
-
Hi there, Thanks for the hard work that you guys are putting. I'm wondering what is the timeline to get the ISR functionality to the market? |
Beta Was this translation helpful? Give feedback.
-
Is there a walkaround to let me generate a simple singe page application? |
Beta Was this translation helpful? Give feedback.
-
Would it be possible to invalidate the statically generated page in "Prerendering" mode without a CI built? That would be quite a cool feature Also how would it look like: I think in next.js it shows a loading spinner, I'd prefer if the client just "waits" until it got SSR rendered and then send the HTML back (for SEO purposes) |
Beta Was this translation helpful? Give feedback.
-
Regarding on-demand pre-rendering: in Nuxt 2, when you modify a Vue component, the whole project is regenerated which is not convenient when the component only affects one route. Would it possible in Nuxt 3 to only regenerate routes impacted by updated components, or is it something not possible with current bundlers? |
Beta Was this translation helpful? Give feedback.
-
Are there any plans to go even beyond the route-based rules and allow finer control over the render method/cache on a component level? For example, a component that does a relative expensive conversion between essentially static files (e.g. markdown > html) you would probably want to render once during the ci build. But on the same page/route you might want to show dynamic content based e.g. user login status etc, so this would be, say, client-side rendering. In nuxt2, I find the options of
These can be specified either in the component declaration or using special wrapper like
Probably related: https://github.com/nuxt/framework/discussions/666 |
Beta Was this translation helpful? Give feedback.
-
Can we also have rewrite rules for any route? Often this is associated with If we can provide something like this, it would be much easier to handle the situation export default defineNuxtConfig({
routes: {
'/public/.well-known/apple-app-site-verification': { contentType: "application/json" }, // Redirect Rules for apple-app-site-verification
}
}) |
Beta Was this translation helpful? Give feedback.
-
What if I develop several server api routes to handle my backend logic, how could I cache /server/api responses so that client side navigation doesn't trigger many server-to-server calls? |
Beta Was this translation helpful? Give feedback.
-
Not clear on this. Using the default app that comes from installing Nuxt3, how do I generate a html page?
Doesn't result in a html page after running |
Beta Was this translation helpful? Give feedback.
-
@pi0 Can you give an indication of what isn't yet working on the generate support? I have
When I do a nuxt build then it says it's pre-rendering It just seems to load the standard scripts, which then construct the HTML on the client side. |
Beta Was this translation helpful? Give feedback.
-
@letoast Sorry, yes, my mistake. But if I set ssr true then I don't see it generated on the server side either. The template is:
I can see from a console.log that it evaluates
The map then loads ok on the client. So although SSR is executing without error, and constructing the |
Beta Was this translation helpful? Give feedback.
-
I can get server to work and static to work. I am struggling to understand where the "hybrid" fits in. I have tried numerous combinations of settings on the Is there some documentation I am missing or it this still to be developed? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Is there a way to set cache-cantrol: no-cache for specific pages? Not just for api, but on the page level. |
Beta Was this translation helpful? Give feedback.
-
Any roadmap regarding when It will be fully implemented? |
Beta Was this translation helpful? Give feedback.
-
Are there any plans to provide SSG capabilities like Next.js |
Beta Was this translation helpful? Give feedback.
-
I created a topic which might be related to what is being discussed in this thread: https://github.com/nuxt/framework/discussions/7140 Can anyone point me to the documentation that might exist to answer my question? |
Beta Was this translation helpful? Give feedback.
-
I notice Pooya's update that an initial version of this implementation landed in nitro. Has anyone tried building an hybrid app using route specific rules (based on whatever has been implemented till now)? It will be very helpful if someone can share a sample repo. Im new to Nuxt, and I understand all the various rendering strategies, and I easily understand and love the above route specific rules implementation with a single "build" command instead of two different commands ("build" & "generate"). But Im struggling with the various combinations of config like ssr, target (not available as per nuxt3 docs), generate (not available as per nuxt3 docs), nitro, nitro.routes & nitro.prerender.routes (with or without crawlLinks), the two different commands - build & generate in nuxt3 context, and also with Daniel's nuxt-full-static module. Is the generate command a shortcut for the build command with nitro.prerender.crawlLinks set to true? Also, am I right in understanding that in nuxt world, "ssg/static" means prerender-without-crawling and "fully static" means prerender-with-crawling? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
Not sure if this is the right place... But here is my problem: |
Beta Was this translation helpful? Give feedback.
-
Regarding the RFC, I wonder if there will be confusion with this |
Beta Was this translation helpful? Give feedback.
-
The problem I am having is when I prerender a route and refresh it then the prerender is working as it should. I get the same page. But when I navigate to that prerendered route via NuxtLink then the setup script runs instead of getting the prerendered route. Is there a way to solve this? Here is an example repo. When I use the NuxtLink in the index.vue then the script setup runs that is in the about.vue so I get a different random number. Refreshing the page gives me the same number every time as it should. Also here is vercel app. |
Beta Was this translation helpful? Give feedback.
-
Questions ;-)
Those would be very useful, that would allow content editor to check page before updating them and to, above all, modify existing pages without rebuilding the whole website once they are satisfied with the preview. |
Beta Was this translation helpful? Give feedback.
-
In case of dynamic routing, how should I set it up? '/blog/[id]' Should I set it like below? in nuxt.config,
|
Beta Was this translation helpful? Give feedback.
-
i have one question! is it alright? in nuxt.config
🙏 |
Beta Was this translation helpful? Give feedback.
-
Why is there no way to set caching rules for single Nuxt page routes? I've been trying to get caching to work for a const handlers = [
{ route: '', handler: _f4b49z, lazy: false, middleware: true, method: undefined }, // global middlewares
{ route: '', handler: _45A4ks, lazy: false, middleware: true, method: undefined },
{ route: '/sitemap.xml', handler: _lazy_EpJV78, lazy: true, middleware: false, method: undefined }, // server route
{ route: '/__nuxt_error', handler: _lazy_CnrjO8, lazy: true, middleware: false, method: undefined }, // nuxt error handler (probably)
{ route: '/**', handler: _lazy_CnrjO8, lazy: true, middleware: false, method: undefined } // every page
]; The only way to cache any Nuxt pages is by creating a route rule for the Am I missing something or has this just not been implemented yet? |
Beta Was this translation helpful? Give feedback.
-
I tried using this syntax but it didn't work: routeRules: {
'/(admin,auth)/**': { ssr: false },
}, How can I combine multiple routes to the same rule? |
Beta Was this translation helpful? Give feedback.
-
This new approach is very powerful, but it also opens up expectations of even more control over rendering ;) Is there a way to invalidate cache for a route without doing a full rebuild? |
Beta Was this translation helpful? Give feedback.
-
Having hybrid rendering open up lot of edge cases that does not fit the actual configuration options. Let's say you have a project like :
If you use plugins in your project that need to be shipped in the client for your SPA (/app/) it will also be shipped in the client entry.js of your static site (/*) and the only configuration you have access is .client or .server but in this case they are both on the client side but you do not want to ship a bunch of dependencies in the entry of your static site. |
Beta Was this translation helpful? Give feedback.
-
What if I want to cache all routes in general except some specific ones?
|
Beta Was this translation helpful? Give feedback.
-
@danielroe Is there a way to verify our config via Nuxt devtools? It is a bit confusing with i18n on top of it. |
Beta Was this translation helpful? Give feedback.
-
Update
Initial version is implemented in unjs/nitro!
Server Rendering Strategies
Generally, we have several possible ways to render a route. In the table below, a summary is added. There are some similarities between these methods and to avoid confusing users for choosing the proper platform, we need a unified way of describing them and mentioning which nuxt version supports which and what are the trade-offs.
Strategy Configuration
We need a schema to describe route/route-groups in
nuxt.config
with their desired rendering strategy. In addition to caching, it can be useful to describe other meta like redirect rules and password protection. One important note is that, this configuration needs to be serializable to be reusable for vendor-specific purposes.Example:
Depending on the nitro platform or in-development, we can map route configuration to proper implementation.
For the context, with nuxt2, we have these options:
mode
/ssr
: Switch on/off SSR for entire projectgenerate.routes
(helping crawler and prerenderer)req.spa
(see Runtime Strategies)static
: Enable Prerender/Crawler for all routesNew
routes
can cover all but we can preserve them as shortcuts and compatibilityRuntime Strategies
Runtime strategies might be also possible but not working for all platforms if they need declarative configuration (like Vercel) and reduce optimization possibilities since we cannot easily predict what will happen for a specific route or if it is a request based rule or not. Yet we can partially support them for special cases (like this). Also we can have a way to infer config from pages.
Client-Side Behavior
Client Rendering behavior also depends on server Strategies:
Beta Was this translation helpful? Give feedback.
All reactions