Skip to content
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

Use Nuxt build with crawler #660

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Use Nuxt build with crawler #660

wants to merge 8 commits into from

Conversation

Siilwyn
Copy link
Member

@Siilwyn Siilwyn commented May 17, 2023

State

Netlify

  • Plausible proxy does not work, returns a http status 401
  • Homepage redirect always redirects to the fallback language /en/
  • Fetches to dato are made despite payloads
  • No trailing slash redirect is done on non-prerendered routes

Cloudflare (Pages)

  • Page payload extraction does not work (fetches are going to dato)
  • Responses are on the slow side 100ms - 300ms vs Netlify's <100ms, requesting a page index.html directly is fast though...

Contact form

Use spam protection? Netlify uses https://akismet.com/

nuxt.config.ts Show resolved Hide resolved
nuxt.config.ts Outdated
},
},
routeRules: {
'/**': { swr: true },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would want to use static: true but doesn't work for some reason...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that every route will now be swr rendered? Or just the routes that didn't get prerendered by the crawler?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the routes that didn't get prerendered, I actually see the docs have changed in the meantime adding isr:

isr - The behavior is the same as swr except that we are able to add the response to the CDN cache on platforms that support this (currently Netlify or Vercel)

@@ -3,7 +3,7 @@
"private": true,
"scripts": {
"dev": "nuxt dev",
"build": "nuxt generate",
"build": "nuxt build",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add a decision log entry for why we're switching to nuxt build. I've written these reasons to switch down in my notes:

  • Blog pagination is difficult with generate
  • Build time
  • Dynamic routes configuration is hard to maintain

nuxt.config.ts Show resolved Hide resolved
nuxt.config.ts Outdated
Comment on lines 18 to 25
nitro: {
prerender: {
crawlLinks: false
}
crawlLinks: true,
routes: ['/en/', '/nl/'],
},
},
routeRules: {
'/**': { swr: true },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do the routeRules work combined with the prerender options? I think it's good to put in some comments about that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think the Nuxt docs should explain this in their docs.

nuxt.config.ts Show resolved Hide resolved
nuxt.config.ts Outdated
},
},
routeRules: {
'/**': { swr: true },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that every route will now be swr rendered? Or just the routes that didn't get prerendered by the crawler?

@Siilwyn Siilwyn force-pushed the nuxt-build-crawl branch 5 times, most recently from 3e7bf0b to 096a032 Compare May 24, 2023 09:51
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 24, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 09374ea
Status: ✅  Deploy successful!
Preview URL: https://7ec8c3bd.voorhoede-website.pages.dev

View logs

@Siilwyn Siilwyn force-pushed the nuxt-build-crawl branch 3 times, most recently from 9b73322 to 2a111ed Compare May 31, 2023 13:07
@Siilwyn Siilwyn force-pushed the nuxt-build-crawl branch 3 times, most recently from 25d5b8c to 1f995cc Compare June 23, 2023 14:31
@Siilwyn
Copy link
Member Author

Siilwyn commented Jun 27, 2023

Crawled pages seem to perform just like production on Netlify! Need to test non-crawled pages behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants