Giter Club home page Giter Club logo

Comments (5)

lilnasy avatar lilnasy commented on May 18, 2024 3

Good first issue!

This is an opportunity for astro users to learn about how astro works by fixing a small but real bug. You can expect to get help setting up the dev environment, and understanding the project structure in #dev channel of our discord server (https://astro.build/chat).

What's the bug?

The functionPerRoute config creates more functions than necessary.

What's going wrong here?

Adapters depend on Astro's Integration API to provide them with the routes to make functions out of. The routes are provided in a map called entrypoints.

Neither Astro nor the vercel adapter make a distinction between prerendered and on-demand rendered routes - all are turned into functions. Only non-prerendered routes should be exposed to the adapter.

Where do I start looking?

The part where Astro's internals pass the entrypoints map to the adapter is here:

await runHookBuildSsr({
config: options.settings.config,
manifest,
logger: options.logger,
entryPoints: internals.entryPoints,
middlewareEntryPoint: shouldPassMiddlewareEntryPoint
? internals.middlewareEntryPoint
: undefined,
});

The part where Astro's internals populate the entrypoints map in the first place is here:

for (const moduleKey of Object.keys(chunk.modules)) {
if (moduleKey.startsWith(RESOLVED_SPLIT_MODULE_ID)) {
internals.ssrSplitEntryChunks.set(moduleKey, chunk);
storeEntryPoint(moduleKey, options, internals, chunk.fileName);
}
}

from astro.

dylanalizon avatar dylanalizon commented on May 18, 2024 2

Your example doesn't have prerendered pages. Please update the example to match the problem you're describing.

@matthewp Hello, the ouput is "hybrid", unless I'm mistaken all pages are prerendered by default, so the index.astro is a prerendered one.

from astro.

mingjunlu avatar mingjunlu commented on May 18, 2024 1

@lilnasy Thanks for providing guidance on this issue! I would like to give it a try πŸ™‚

from astro.

matthewp avatar matthewp commented on May 18, 2024

Your example doesn't have prerendered pages. Please update the example to match the problem you're describing.

from astro.

github-actions avatar github-actions commented on May 18, 2024

Hello @bentouch-digital. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

from astro.

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.