Prerender routes json#7708
Prerender routes json#7708colecrouter wants to merge 7 commits intosveltejs:masterfrom colecrouter:prerender-routes-json
Conversation
|
|
Y'know, I suppose it would break the prerender tests, wouldn't it? haha |
|
Not sure about that last test. I can't seem to get |
|
Thanks you but we can't just change I'm also not sure this approach scales very far. There's quote a low limit to the number of entries you can have in your |
That's what I've been alluding to in #7298 . I've got it working to Cloudflare's spec using wrangler, and The one failed test says something is wrong, but I can't seem to get it to work no matter what I do (I'm not too familiar with playwright, unfortunately). Aside from that, it seems to work fine for me "in practice".
~100 prerendered pages? How about adding a cap, or a switch + warning if over 100 entries. Then the worst case would be what's currently happening. |
Added changeset Updated test to reflect new output path
|
@Mexican-Man is attempting to deploy a commit to the Svelte Team on Vercel. A member of the Team first needs to authorize it. |
|
Instead of automatically excluding prerendered pages, I've put in an adapter option that lets you manually specify if you want to bypass. That seems a lot safer. The Vite exports for prerendered pages are working properly now, so any prerendered test errors seem to be resolved (on my computer). |
|
I merged #8422, which adds all assets and prerendered pages (up to the 100-rule limit), so I'll close this — thanks. In general I think the automated approach is preferable to manually specifying exclusions, though in the rare cases that it is necessary it could be done by modifying the |
|
Bit late, but just wanted to say thanks. I just took a look at last month's bill, and we're down 85% on billed requests 😊(just from prerendered pages, alone). HUGE; thanks @Rich-Harris! |
Problem
Prerendered pages on
adapter-cloudflareshould not require a worker request. See issue for more info #7298Solution
Prerender pages as
/foo/index.htmlinstead of/foo.html, then exclude/fooin_routes.json. This will bypass the worker entirely, and still serve the prerendered page.I ran the test suite, and tested it on my site with
vite devand deployed to Cloudflare Pages. I got the feeling that the change topackages/kit/src/core/prerender/prerender.jswould cause more friction that it seemed to.