Code Monkey home page Code Monkey logo

Comments (9)

RyanClementsHax avatar RyanClementsHax commented on July 18, 2024 1

I'd be happy to take a look at this

from nuxt.

RyanClementsHax avatar RyanClementsHax commented on July 18, 2024 1

@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.

stackblitz avatar stackblitz commented on July 18, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from nuxt.

RyanClementsHax avatar RyanClementsHax commented on July 18, 2024

It seems nitro is being handed the wrong route options when prerendering here

await prerender(nitro)

I'm debugging further

from nuxt.

RyanClementsHax avatar RyanClementsHax commented on July 18, 2024

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.

  1. 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.
  2. 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.

danielroe avatar danielroe commented on July 18, 2024

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.

RyanClementsHax avatar RyanClementsHax commented on July 18, 2024

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.

danielroe avatar danielroe commented on July 18, 2024

Yes. And go for it ❤️

from nuxt.

danielroe avatar danielroe commented on July 18, 2024

Yes, that’s what I’m suggesting…

from nuxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.