fix(cloudflare): allow compile-time image optimization for prerendered pages#53
fix(cloudflare): allow compile-time image optimization for prerendered pages#53stancl wants to merge 2 commits intowithastro:mainfrom
Conversation
|
|
@stancl, my apologies for the delayed response; I was finalizing a component to share here. From our Discord conversation, we recognized that incorporating a solution for optimization at build/compile time, as well as for server-side rendering (SSR), adds a level of complexity that may exceed the scope of this current PR. Nonetheless, we agreed that it's beneficial to provide users with the flexibility to choose between build/compile time optimization and runtime optimization. In line with this, and leveraging my work on an external image service, I've introduced an adapter configuration flag that can easily accommodate new options. I propose we extend this configuration to support build/compile time optimization as a selectable option. Regarding implementation, we have a few paths forward: a) You could rebase your branch onto the feature branch and incorporate this addition. I would advocate for options a or b to ensure that you receive full credit for this contribution, though I am mindful of the extra effort this may entail. Please share your preference on how you wish to proceed. |
|
I'm fine with you implementing this in your own branch, the PR was more so to provide something more direct (even if very incomplete) than opening an issue. The concept behind the solution is Erika's, not mine, so no need for any credit here :) |
|
Closing in favor of #57 |
Changes
TLDR of the issue: the driver currently unnecessarily blocks image optimization even if it could be used just fine on static pages. The only issue is with including the image services in the SSR bundle.
I was more or less trying to reimplement the solution discussed on Discord but realized we don't actually need to re-export the services here, since the entire point of that was bypassing the if check in this code I believe.
So the only change now is adding an endpoint.
TODOs:
<Image>tags. Maybe the endpoint can handle that? Otherwise we could maybe specify the entrypoint conditionally, i.e. something like this (I think?)@alexanderniebuhr
Testing
Docs