-
Notifications
You must be signed in to change notification settings - Fork 19
/
astro.config.ts
131 lines (123 loc) · 4.41 KB
/
astro.config.ts
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import { defineConfig } from 'astro/config';
// https://astro.build/config
import Icons from 'unplugin-icons/vite';
import { FileSystemIconLoader } from 'unplugin-icons/loaders';
// https://astro.build/config
import svelte from "@astrojs/svelte";
import tailwind from "@astrojs/tailwind";
import sitemap from "@astrojs/sitemap";
import serviceWorker from "astrojs-service-worker";
import adapter from "astro-auto-adapter";
import type { RangeRequestsPlugin as RangeRequestsPluginType } from "workbox-range-requests"
import RangeRequestsPlugin, { urlPattern } from './range-requests.mjs';
// https://astro.build/config
export default defineConfig({
site: "https://inthistweet.app",
integrations: [
svelte(),
tailwind(),
sitemap({ customPages: ['https://inthistweet.app/'] }),
// serviceWorker({
// // enableInDevelopment: true,
// registration: { autoRegister: true },
// // @ts-ignore
// workbox: {
// skipWaiting: true,
// clientsClaim: true,
// additionalManifestEntries: [
// "/",
// "https://inthistweet.app"
// ],
// // globDirectory: outDir,
// globPatterns: ["**/*.{html,js,css,svg,ttf,woff2,png,webp,jpg,jpeg,wasm,ico,json,xml}"], //
// ignoreURLParametersMatching: [/index\.html\?(.*)/, /\\?(.*)/],
// cleanupOutdatedCaches: true,
// // Define runtime caching rules.
// runtimeCaching: [
// {
// // Match any request that starts with https://api.producthunt.com, https://api.countapi.xyz, https://opencollective.com, etc...
// urlPattern,
// // Apply a network-first strategy.
// handler: "NetworkFirst",
// method: "GET",
// options: {
// cacheableResponse: {
// statuses: [0, 200]
// },
// plugins: [
// new RangeRequestsPlugin() as unknown as RangeRequestsPluginType
// ],
// matchOptions: {
// ignoreSearch: true,
// ignoreVary: true
// }
// }
// },
// {
// // Match any request that starts with https://api.producthunt.com, https://api.countapi.xyz, https://opencollective.com, etc...
// urlPattern:
// /(?:^https:\/\/(?:.*)\.twimg\.com)|(?:\/api\/twitter)|(?:\/take-measurement$)|(?:^https:\/\/((?:api\.producthunt\.com)|(?:api\.countapi\.xyz)|(?:opencollective\.com)|(?:giscus\.bundlejs\.com)))/,
// // Apply a network-first strategy.
// handler: "NetworkFirst",
// method: "GET",
// options: {
// cacheableResponse: {
// statuses: [0, 200]
// },
// }
// },
// {
// // Match any request that ends with .png, .jpg, .jpeg, .svg, etc....
// urlPattern:
// /workbox\-(.*)\.js|\.(?:png|jpg|jpeg|svg|webp|map|ts|wasm|css)$|^https:\/\/(?:cdn\.polyfill\.io)/,
// // Apply a stale-while-revalidate strategy.
// handler: "NetworkFirst",
// method: "GET",
// options: {
// cacheableResponse: {
// statuses: [0, 200]
// }
// }
// },
// {
// // Cache `monaco-editor` etc...
// urlPattern:
// /(?:(?:chunks|assets|favicon|fonts|giscus)\/(.*)$)/,
// // Apply a network-first strategy.
// handler: "NetworkFirst",
// method: "GET",
// options: {
// cacheableResponse: {
// statuses: [0, 200]
// },
// }
// },
// ]
// }
// })
],
output: "hybrid",
adapter: await adapter(undefined, {
"deno": {
port: 4321
}
}),
vite: {
plugins: [
Icons({
// experimental
autoInstall: true,
compiler: 'svelte',
customCollections: {
// a helper to load icons from the file system
// files under `./assets/icons` with `.svg` extension will be loaded as it's file name
// you can also provide a transform callback to change each icon (optional)
'local': FileSystemIconLoader(
'./src/icons',
svg => svg.replace(/^<svg /, '<svg fill="currentColor" '),
),
},
}),
]
}
});