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)
- render issues does not throw in SSR HOT 1
- `nuxt.options.nitro.publicAssets.push` leads to 404 errors HOT 8
- useFetch only prevents multiple requests when `key` option is set HOT 1
- `navigateTo` calls made inside plugins are reverted in `app:created` hook
- `useCookie` does not work correctly in Chrome HOT 1
- Nuxt 3 locale javascript files not working after page changes
- Nitro server plugin called twice in dev-server with ssr: false HOT 2
- New pages are mounted before the previous page unmounts HOT 2
- type issue when returning undefined with `getCachedData` HOT 1
- Nitro `close` hook not being called when stopping dev server HOT 1
- The regex caused the auto-imports to fail. HOT 2
- TypeError in production builds HOT 4
- `onBeforeRouteLeave` triggered by `router.replace({ query: {...} })` since `v3.12.3` HOT 4
- eager dependency pre-bundling is no longer working HOT 6
- FullCalendar table disappears when switching pages HOT 1
- Vite import types are not included with nuxt
- Catch or ignore import errors on modules/plugins
- how to import typescript package in nuxt ? HOT 1
- Uncaught (in promise) non-precached-url: non-precached-url :: [{"url":"/"}] HOT 2
- Nuxt Project Stopped Working During Windows 11 Development HOT 1
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.