-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workaround prerender in pageMap #227
workaround prerender in pageMap #227
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why this can't be done with a single plugin. Can't you do one loop after the other in the same plugin?
@Fryuni Updated the logic, now the regexp should be much safer. wdyt? |
If this workarounds some issue with pre-rendering currently, then the code seems fine to me. But I think given the workarounds needed so far, we should prioritize making prerendering more robust in Astro core. |
Seems good now. Well, as good as a workaround using regex can be 😅
Pre-rendering itself is not a problem. The fact that Astro builds a single bundle for pre-rendering and server rendering and considers the other as (hopefully) unreachable code is the problem. If you have a single server route, you need to upload the code to generate all your routes, which can hit the target platform's source size limits. This was noticed first on Cloudflare because it has the smallest limit for the free tier, but Vercel, Netlify, and others are also subject to this problem if you have a big enough project. |
a6b5f78
into
feat/cloudflare-exclude-prerender-chunks
we need to plugins so we can use
generateBundle
twice. Any other hook doesn't have file names with hashes already, and usingwriteBundle
would needfs
operation, which I think is worse.regex
is scary, but I'm not sure if it is worth to create an ast and convert back to string again