flotilla/vite.config.ts

81 lines
2.7 KiB
TypeScript
Raw Normal View History

2024-12-02 17:51:50 +00:00
import {config} from "dotenv"
2024-10-22 23:23:54 +00:00
import {defineConfig} from "vite"
2024-10-23 16:45:06 +00:00
import {SvelteKitPWA} from "@vite-pwa/sveltekit"
2024-08-05 22:28:46 +00:00
import {sveltekit} from "@sveltejs/kit/vite"
import svg from "@poppanator/sveltekit-svg"
2024-08-01 23:49:32 +00:00
2026-03-06 21:58:03 +00:00
config({path: ".env.local"})
2026-04-02 21:00:07 +00:00
config({path: ".env"})
2024-10-22 23:23:54 +00:00
2024-10-22 23:53:39 +00:00
export default defineConfig({
2026-08-06 15:43:57 +00:00
// @welshman/editor takes tiptap as peer dependencies, so an installed copy resolves them from
// here and there is one prosemirror. link-deps.mjs symlinks its source instead, and that directory
2026-08-06 15:43:57 +00:00
// carries node_modules from welshman's own install — a second prosemirror, whose Plugin and
// PluginKey classes tiptap refuses to mix with ours ("Adding different instances of a keyed
// plugin"). Deduping resolves these to this project's copy wherever they are imported from, and
2026-08-11 21:54:05 +00:00
// does nothing when only one copy exists. Vite resolves a deduped package from the project root
// and nowhere else, so every name listed here has to be a direct dependency — under pnpm a
// transitive one isn't reachable from the root and the build fails to resolve it.
2026-08-06 15:43:57 +00:00
resolve: {
dedupe: [
"@tiptap/core",
"@tiptap/pm",
"@tiptap/suggestion",
"prosemirror-model",
"prosemirror-state",
"prosemirror-transform",
"prosemirror-view",
],
},
2024-10-22 23:53:39 +00:00
server: {
port: 1847,
2025-11-13 00:20:38 +00:00
// host: "0.0.0.0",
// strictPort: true,
// allowedHosts: ["coracle-client.ngrok.io"],
// hmr: {
// protocol: "wss",
// host: "coracle-client.ngrok.io",
// clientPort: 443,
// },
// cors: true,
2024-10-22 23:53:39 +00:00
},
build: {
sourcemap: true,
},
plugins: [
sveltekit(),
SvelteKitPWA({
registerType: "autoUpdate",
injectRegister: "auto",
workbox: {
maximumFileSizeToCacheInBytes: 5 * 1024 ** 2, // 5 MB or set to something else
},
2024-10-22 23:53:39 +00:00
manifest: {
2024-10-23 15:55:40 +00:00
name: process.env.VITE_PLATFORM_NAME,
short_name: process.env.VITE_PLATFORM_NAME,
theme_color: process.env.VITE_PLATFORM_ACCENT,
description: process.env.VITE_PLATFORM_DESCRIPTION,
2024-10-23 16:45:06 +00:00
// @ts-ignore
2024-10-22 23:53:39 +00:00
permissions: ["clipboardRead", "clipboardWrite", "unlimitedStorage"],
icons: [
{src: "pwa-64x64.png", sizes: "64x64", type: "image/png"},
{src: "pwa-192x192.png", sizes: "192x192", type: "image/png"},
{src: "pwa-512x512.png", sizes: "512x512", type: "image/png", purpose: "any"},
2024-10-22 23:23:54 +00:00
{
2024-10-22 23:53:39 +00:00
src: "maskable-icon-512x512.png",
sizes: "512x512",
2024-10-22 23:23:54 +00:00
type: "image/png",
2024-10-22 23:53:39 +00:00
purpose: "maskable",
2024-10-22 23:23:54 +00:00
},
2024-10-22 23:53:39 +00:00
],
},
}),
svg({
svgoOptions: {
multipass: true,
2026-05-25 16:59:22 +00:00
plugins: ["preset-default", "removeDimensions"],
2024-10-22 23:53:39 +00:00
},
}),
],
2024-08-05 22:28:46 +00:00
})