-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Several chunk files are added to the SSR bundle for every prerendered mardkown files #10552
Comments
cc @Skn0tt |
I can also see these files being generated, but I'm not aware of anything specific to the Netlify adapter that would cause it. I'm seeing the same behaviour with While those files are generated, I don't see them referenced from any other generated file. This also means that Netlify's bundling mechanism won't include them in the Lambda, so they shouldn't lead to any upload failures because of bundle size. @alexanderniebuhr should we move this ticket into Astro core for investigation? |
Trying to understand if the issue belongs to content collections or astro code, still, this is concerning. |
I think we do face the same issue in Cloudflare v10 now. Maybe it helps debugging (withastro/adapters#218) |
@alexanderniebuhr In my case I have a file with 21.8 MB that have index name prefix inside the pages folder
EDIT: my bad the issue was that I used lots of |
I don't think this is actually a bug. It's a side-effect of the fact that content collections compile to JavaScript. We are not able to "tree shake" unused collections because those APIs are completely dynamic. We are investigating having CC be backed by a database as an alternative to the JS structure. That may or may not help with this type of issue. |
@matthewp I agree with you. I think the initial issue was, that all the "pages" even if prerendered ended up in the output, due to the prerendering chunk issue. But since we do have a solution for that incoming, I'm not sure if that is still an issue here, or if that this issue is also resolved by that 🤔 |
I initially thought that #11245 would fix this, but it doesn't as content collection adds all collection entries as Rollup entries: astro/packages/astro/src/core/build/plugins/plugin-content.ts Lines 135 to 146 in 7d59750
Which makes the prerender plugin think that they have other uses, and doesn't mark them for deletion. It's possible to improve this interaction, perhaps easiest if content collection put each in their own non-entry chunk (with Other than that, what Matthew mention is still true though as long as one non-prerendered pages uses |
Ok, going to close as I don't think there's anything we can fix about this. |
Astro Info
Describe the Bug
When publishing an Astro project with output set to
hybrid
, it appears the Netlify adapter will add to thessr/functions-internal/ssr/chunks
directory several files for every markdown files present in thecontent
directory.It seems only invoking the
getCollections
method on one collection suffice for all the "content" files to be added to the bundle.For one
advancing-la-crosse.md
following files are generated: (I suppose the bigger the content, the more chunks).netlify/functions-internal/ssr/chunks/advancing-la-crosse_HTeAmckn.mjs
netlify/functions-internal/ssr/chunks/advancing-la-crosse_WrVGU8CN.mjs
.netlify/functions-internal/ssr/chunks/advancing-la-crosse_YBMYQhAr.mjs
This happens even though the project only sports one SSR route with no relations to the markdown files.
I'm afraid this could quickly bloat the bundle on big projects and potentially generate the dreaded following error which I'm currently experiencing on some projects. It breaks the build during the deploy state:
What's the expected result?
The bundle should only add the chunks needed for the SSR routes to be functionnal.
Link to Minimal Reproducible Example
https://github.com/regisphilibert/astro-issue-repro-ssl-bundle-collections
Participation
The text was updated successfully, but these errors were encountered: