Unfollow tool for Bluesky
1import { defineConfig } from "vite"; 2import solidPlugin from "vite-plugin-solid"; 3// import devtools from 'solid-devtools/vite'; 4 5import metadata from "./public/client-metadata.json"; 6 7const SERVER_HOST = "127.0.0.1"; 8const SERVER_PORT = 13213; 9 10export default defineConfig({ 11 plugins: [ 12 /* 13 Uncomment the following line to enable solid-devtools. 14 For more info see https://github.com/thetarnav/solid-devtools/tree/main/packages/extension#readme 15 */ 16 // devtools(), 17 solidPlugin(), 18 19 // Injects OAuth-related variables 20 { 21 name: "oauth", 22 config(_conf, { command }) { 23 if (command === "build") { 24 process.env.VITE_OAUTH_CLIENT_ID = metadata.client_id; 25 process.env.VITE_OAUTH_REDIRECT_URL = metadata.redirect_uris[0]; 26 } else { 27 const redirectUri = ((): string => { 28 const url = new URL(metadata.redirect_uris[0]); 29 return `http://${SERVER_HOST}:${SERVER_PORT}${url.pathname}`; 30 })(); 31 32 const clientId = 33 `http://localhost` + 34 `?redirect_uri=${encodeURIComponent(redirectUri)}` + 35 `&scope=${encodeURIComponent(metadata.scope)}`; 36 37 process.env.VITE_DEV_SERVER_PORT = "" + SERVER_PORT; 38 process.env.VITE_OAUTH_CLIENT_ID = clientId; 39 process.env.VITE_OAUTH_REDIRECT_URL = redirectUri; 40 } 41 42 process.env.VITE_CLIENT_URI = metadata.client_uri; 43 process.env.VITE_OAUTH_SCOPE = metadata.scope; 44 }, 45 }, 46 ], 47 server: { 48 host: SERVER_HOST, 49 port: SERVER_PORT, 50 }, 51 build: { 52 target: "esnext", 53 }, 54});