Comments (9)
I'd be happy to take a look at this
from nuxt.
@danielroe Thanks for your patience. I've been helping my wife with morning sickness (we're having another kid!!!).
Anyway, regarding the prerenderRoutes
function, I played around with it to learn how prerendering works and see that it is only additive to what the prerenderer generates. Given nitro is preconfigured to generate all of the routes in the pages
directory, are you suggesting that we remove this logic from the module and expose the routes to crawl using the plugin?
(pls correct me if my understanding is wrong)
from nuxt.
Start a new pull request in StackBlitz Codeflow.
from nuxt.
It seems nitro is being handed the wrong route options when prerendering here
nuxt/packages/nuxt/src/core/nitro.ts
Line 501 in ec5d254
I'm debugging further
from nuxt.
The prerender config is set by this line which sets it to a set of pages from created only from pages within the /pages
directory.
The custom router.options.ts
seems only imported by the runtime code generated by this template.
I see now that the pages module doesn't have the final routing config in memory when creating the prerendering config.
I see a few ways to tackle this. Let me know if there are others.
- Import the
router.options.ts
file (and any other files) in the pages module to discover what the final routing config resolves to.- Is there precedent for something similar elsewhere in nuxt? I haven't found anything yet, but I'll keep looking.
- Change the way prerendering works to introspect the running site to discover what routes exist.
- Based on what I know about nitro and nuxt thus far, this seems like it would require a change to nitro and the generated app for prerendering. I could be wrong though.
@danielroe any thoughts?
from nuxt.
I think we should use a Nuxt plugin that is guarded by import.meta.prerender
so it does not add anything to the final build, and which only executes once, passing all paths to the prerenderRoutes
composable.
(this would only be if ssr: true
)
from nuxt.
Just to make sure we are talking about the same piece of code, you're referring to this composable correct?
Also, I'll be happy to take this on if you want to assign it to me.
from nuxt.
Yes. And go for it ❤️
from nuxt.
Yes, that’s what I’m suggesting…
from nuxt.
Related Issues (20)
- Tailwindcss added at last is not applied HOT 5
- Disabling SSR prevents remaining CSS from loading HOT 5
- Error: Cannot find module punycode/ HOT 9
- Img @error not working HOT 2
- useHead undefined after initiating a regex (since monday) HOT 4
- keepalive not work HOT 1
- String vs object errors with `createError` and accessing server-thrown errors on client
- Tailwind css issue related to CSS specificity on dev server HOT 1
- keep alive caches are destroyed when visit keep alive excluded page HOT 3
- The package generated under the .output/server/node_modules file is a hyperlink. HOT 2
- 'text/html' is not a valid JavaScript MIME type. HOT 2
- This module cannot be imported in the Vue part of your app. [importing @nuxt/kit from app.vue] causing page to not work HOT 5
- If a component uses empty data in `useFetch`, then `clearError` will be invalidated HOT 2
- Cache control header missing in response headers (while using nitro.publicAssets) HOT 7
- [nuxt] [request error] [unhandled] [500] _fetch is not a function HOT 3
- feat: support passing options to `TypedRouterOptions` when using `experimental.typedPages` HOT 3
- Dynamic layouts HOT 4
- Previous route info HOT 2
- Imported CSS files not correctly injected in circumstances involving lazy-loaded components HOT 1
- Nuxt 3 Dev build time is very slow in WSL 2 Linux Ubuntu ~ ranging up to 30 seconds just to refresh changes HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nuxt.