JavaScript-optional public web frontend for Bluesky
anartia.kelinci.net
sveltekit
atcute
bluesky
typescript
svelte
1import { sveltekit } from '@sveltejs/kit/vite';
2import { defineConfig } from 'vite';
3
4export default defineConfig(({ command }) => {
5 return {
6 build: {
7 target: 'es2024',
8 },
9 esbuild: {
10 target: 'es2024',
11 },
12 plugins: [
13 sveltekit(),
14
15 // Nasty hack to remove the hydration markers that SvelteKit adds to the HTML
16 // command === 'build' && {
17 // name: 'remove-hydration-markers',
18 // transform(code, id, options) {
19 // if (id.endsWith('.svelte') && code.includes('$$payload')) {
20 // code = code
21 // .replace(/<!--.*?-->/g, '')
22 // .replace(/\$\$slots: {.+?},?/g, '')
23 // .replace(/\$\$payload\.out \+= ["'`]{2};|\$\.(push|pop)\(\);/g, '')
24 // .replace(/(?<=\$\$payload\.out \+= )`\${([a-zA-Z0-9_$.,()[\]\s]+?)}`(?=;)/, '$1');
25
26 // return code;
27 // } else if (id.includes('node_modules/svelte/') && code.includes('<!--')) {
28 // code = code.replace(/(['`])<!--.*?-->\1/g, '$1$1');
29
30 // return code;
31 // }
32 // },
33 // },
34 ],
35 };
36});