feat: prefetch pages for better navigation

This commit is contained in:
iCrawl
2022-10-09 01:03:44 +02:00
parent 1b4f69b00a
commit 32297d4717
3 changed files with 23 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import { fileURLToPath, URL } from 'node:url';
import image from '@astrojs/image';
import mdx from '@astrojs/mdx';
import prefetch from '@astrojs/prefetch';
import react from '@astrojs/react';
import { remarkCodeHike } from '@code-hike/mdx';
import { defineConfig } from 'astro/config';
@@ -49,6 +50,9 @@ export default defineConfig({
image({
serviceEntryPoint: '@astrojs/image/sharp',
}),
prefetch({
throttle: 3,
}),
Unocss({
configFile: fileURLToPath(new URL('../ui/unocss.config.ts', import.meta.url)),
}),

View File

@@ -40,7 +40,6 @@
"@code-hike/mdx": "^0.7.4",
"@discordjs/ui": "workspace:^",
"ariakit": "^2.0.0-next.41",
"astro": "^1.4.6",
"cmdk": "^0.1.20",
"meilisearch": "^0.28.0",
"react": "^17.0.2",
@@ -52,6 +51,7 @@
"shiki": "^0.11.1"
},
"devDependencies": {
"@astrojs/prefetch": "^0.0.8",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/node": "^16.11.64",
@@ -62,6 +62,7 @@
"@unocss/reset": "^0.45.28",
"@vitejs/plugin-react": "^2.1.0",
"@vitest/coverage-c8": "^0.24.0",
"astro": "^1.4.6",
"astro-compress": "^1.0.11",
"astro-critters": "^1.0.5",
"cross-env": "^7.0.3",

View File

@@ -255,6 +255,15 @@ __metadata:
languageName: node
linkType: hard
"@astrojs/prefetch@npm:^0.0.8":
version: 0.0.8
resolution: "@astrojs/prefetch@npm:0.0.8"
dependencies:
throttles: ^1.0.1
checksum: 2e68855b570b498bd7431a0be24d8c45975ff7b2b79ad6d853d0539ee03351d24ff281fcc7902ea93da32bcfe6d887187495e412a04b0679cb65da7341f63c92
languageName: node
linkType: hard
"@astrojs/prism@npm:^1.0.0, @astrojs/prism@npm:^1.0.1":
version: 1.0.1
resolution: "@astrojs/prism@npm:1.0.1"
@@ -2108,6 +2117,7 @@ __metadata:
dependencies:
"@astrojs/image": ^0.9.2
"@astrojs/mdx": ^0.11.4
"@astrojs/prefetch": ^0.0.8
"@astrojs/react": ^1.1.4
"@code-hike/mdx": ^0.7.4
"@discordjs/ui": "workspace:^"
@@ -18948,6 +18958,13 @@ __metadata:
languageName: node
linkType: hard
"throttles@npm:^1.0.1":
version: 1.0.1
resolution: "throttles@npm:1.0.1"
checksum: 0f3b36b8fcba720df7ab283f40f4e4d6b1b31939dba7fafac6e4e8bc1743eeaff546916a66344be7af1d7a2d014d799e7924009a15118887aef0cfc5292559a1
languageName: node
linkType: hard
"through2@npm:^2.0.0":
version: 2.0.5
resolution: "through2@npm:2.0.5"