I want to ignore the generation of certain files when generating
I looked up information and found that there is nitro.prerender.ignore, but it does not support wildcards [for example: /game-detail/* and /game-detail/[gameid]], and only supports the full path /home. Are there any other ways to achieve it?
3 Replies
Hi @xuxchao. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the available knowledge sources, the
-
nitro.prerender.ignore
option in your nuxt.config.ts
only supports ignoring specific, full paths and does not support wildcards or dynamic route patterns like /game-detail/*
or /game-detail/[gameid]
for prerendering exclusion. This limitation is explicitly mentioned in user experiences and documentation, and there is no official support for wildcards in nitro.prerender.ignore
at this time How to make Nuxt 3 correctly build SSG pages + dynamic API routes?.
However, you can use the prerender:generate
Nitro hook for more fine-grained control. This hook is called for each route during prerendering, and you can programmatically skip routes based on custom logic, including matching patterns or wildcards:
This approach allows you to effectively ignore dynamic or wildcard routes during prerendering, even though the ignore
array itself does not support wildcards Runtime prerender configuration.
If you need to skip more complex patterns, you can use regular expressions or other string matching logic inside the hook.
Summary:-
nitro.prerender.ignore
does not support wildcards.
- Use the prerender:generate
Nitro hook for pattern-based exclusion of routes during prerendering.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@491180576943112192> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I find this does work. He doesn't generate files, but the page logic is still executed. Is there any way to prevent the page logic from being executed as well?