-
Notifications
You must be signed in to change notification settings - Fork 746
Expand file tree
/
Copy pathastro.config.mjs
More file actions
57 lines (56 loc) · 1.74 KB
/
Copy pathastro.config.mjs
File metadata and controls
57 lines (56 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { defineConfig } from 'astro/config'
import react from '@astrojs/react'
import sitemap from '@astrojs/sitemap'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
site: 'https://www.reactjs.wiki',
output: 'static',
trailingSlash: 'never',
prefetch: {
prefetchAll: true,
defaultStrategy: 'hover',
},
build: {
concurrency: 10,
// Incrusta el CSS en el HTML en lugar de enlazarlo. El <link> obligaba a un
// round-trip extra en serie (el navegador no descubre la hoja hasta que
// parsea el head) que bloqueaba el primer pintado. Con el CSS dentro del
// documento, el HTML llega listo para pintar.
// Se pierde el cacheo de la hoja entre paginas, pero el CSS global ya se
// dividio por ruta (global vs article) y el prefetch deja las paginas
// calientes de todas formas.
inlineStylesheets: 'always',
},
experimental: {
// Prerender prefetched pages via the Speculation Rules API (Chromium)
clientPrerender: true,
},
integrations: [
react(),
sitemap({
filter: page => !page.includes('/404'),
changefreq: 'weekly',
priority: 0.8,
lastmod: new Date(),
serialize(item) {
if (item.url === 'https://www.reactjs.wiki/') {
return { ...item, changefreq: 'daily', priority: 1 }
}
if (item.url.endsWith('/questions')) {
return { ...item, changefreq: 'weekly', priority: 0.9 }
}
// Article/question pages
if (
item.url !== 'https://www.reactjs.wiki/' &&
!item.url.endsWith('/questions')
) {
return { ...item, changefreq: 'monthly', priority: 0.7 }
}
return item
},
}),
],
vite: {
plugins: [tailwindcss()],
},
})