personal web client for Bluesky
typescript
solidjs
bluesky
atcute
1import * as path from 'node:path';
2
3import { cloudflare } from '@cloudflare/vite-plugin';
4import { defineConfig } from 'vite';
5import { VitePWA } from 'vite-plugin-pwa';
6import solid from 'vite-plugin-solid';
7
8export default defineConfig({
9 build: {
10 target: 'esnext',
11 modulePreload: false,
12 sourcemap: true,
13 assetsInlineLimit: 0,
14 minify: 'terser',
15 rollupOptions: {
16 output: {
17 chunkFileNames: 'assets/[hash].js',
18 manualChunks: {
19 common: [
20 'solid-js',
21 'solid-js/store',
22 'solid-js/web',
23
24 '@atcute/client',
25 '@atcute/oauth-browser-client',
26 '@mary/events',
27 '@mary/solid-query',
28
29 'src/service-worker.tsx',
30
31 'src/globals/events.ts',
32 'src/globals/locales.ts',
33 'src/globals/modals.tsx',
34 'src/globals/navigation.ts',
35 'src/globals/preferences.ts',
36
37 'src/lib/states/agent.tsx',
38 'src/lib/states/session.tsx',
39 'src/lib/states/theme.tsx',
40 ],
41 shell: ['src/shell.tsx'],
42 },
43 },
44 },
45 terserOptions: {
46 compress: {
47 passes: 3,
48 },
49 },
50 },
51 resolve: {
52 alias: {
53 '~': path.join(__dirname, './src'),
54 },
55 },
56 server: {
57 allowedHosts: ['.trycloudflare.com'],
58 },
59 optimizeDeps: {
60 esbuildOptions: {
61 target: 'esnext',
62 },
63 },
64 plugins: [
65 solid({
66 babel: {
67 plugins: [['babel-plugin-transform-typescript-const-enums']],
68 },
69 }),
70
71 cloudflare(),
72
73 VitePWA({
74 registerType: 'prompt',
75 injectRegister: null,
76 workbox: {
77 globPatterns: ['**/*.{js,css,html,svg,jpg,png}'],
78 cleanupOutdatedCaches: true,
79 },
80 manifest: {
81 id: '/',
82 start_url: '/',
83 scope: '/',
84 name: 'Aglais',
85 short_name: 'Aglais',
86 description: 'Alternative web client for Bluesky',
87 display: 'standalone',
88 background_color: '#000000',
89 icons: [
90 {
91 src: 'favicon.png',
92 type: 'image/png',
93 sizes: '150x150',
94 },
95 ],
96 },
97 }),
98
99 // Transform the icon components to remove the `() => _tmpl$()` wrapper
100 {
101 name: 'aglais-icon-transform',
102 transform(code, id) {
103 if (!id.includes('/icons-central/')) {
104 return;
105 }
106
107 const transformed = code.replace(
108 /(?<=createIcon\()\(\)\s*=>*.([\w$]+)\(\)(?=\))/g,
109 (_match, id) => id,
110 );
111
112 return { code: transformed, map: null };
113 },
114 },
115 ],
116});