qwik icon indicating copy to clipboard operation
qwik copied to clipboard

Static files cannot be generated using useEndpoint

Open sanqi opened this issue 3 years ago • 8 comments

Qwik Version

0.14.0

Operating System (or Browser)

chrome

Node Version (if applicable)

Node.js v17.6.0

Which component is affected?

Qwik City

Expected Behaviour

After upgrading qwik-city 0.0.122 to 0.0.124

Actual Behaviour

0.0.124 cloudflare-pages cannot generate static files using useEndpoint

Additional Information

No response

sanqi avatar Nov 22 '22 07:11 sanqi

i dont understand the issue, can you please explain a bit more? what is happening and what ypu would expect

manucorporat avatar Nov 22 '22 09:11 manucorporat

For versions after qwik-city 0.0.122, the cloudflare-pages adapter cannot generate correct static files, If I use the useEndpoint function in a route file. new version breaks cloudflare-pages adapter's function of generating static files, which was not the case before.

sanqi avatar Nov 22 '22 14:11 sanqi

would you expect to generate a static page instead of SSR? if it uses a useEndpoint() wouldn't you want to have it dynamic?

manucorporat avatar Nov 22 '22 20:11 manucorporat

I configured cloudflarePagesAdaptor with staticGenerate: true, so I want to keep generating static files even with useEndpoint.

If I want to use SSR, I just need to remove staticGenerate, this is easy to do in old version to control SSR or SSG switching, current new version breaks this

In the new version, even if I configure the Dynamic SSG Routes function, I cannot turn on SSG to generate static files.

sanqi avatar Nov 22 '22 23:11 sanqi

now it's doing both SSR + SSG, dynamic paths use SSR, but i see the confusion

manucorporat avatar Nov 25 '22 21:11 manucorporat

So when you do have staticGenerate: true, any dynamic pages you'd like to SSR instead of SSG are not working. Would you be able to create a minimal example showing the issue? Thanks

adamdbradley avatar Nov 29 '22 20:11 adamdbradley

For example, I have Ghost as headless CMS, I like to fetch articles during the build and generate static files. Articles' routes are different from each other. for example domain.com/blog/[tag]/[slug]

adnanebrahimi avatar Jan 02 '23 09:01 adnanebrahimi

@adamdbradley I created an example: https://github.com/adnanebrahimi/qwik-ssg-cloudflare-adaptor

adnanebrahimi avatar Jan 03 '23 08:01 adnanebrahimi