anydrop/web/vite.config.ts
ordinarthur f23cb7bffc
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 38s
fix: explicit MIME types for iOS share target
iOS Safari ignores wildcard */* in share_target accept.
List specific MIME types and file extensions so AnyDrop
appears in the iOS share sheet for photos, videos, docs, etc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-14 12:58:44 +02:00

88 lines
2.4 KiB
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { VitePWA } from "vite-plugin-pwa";
import { nodePolyfills } from "vite-plugin-node-polyfills";
export default defineConfig({
define: {
global: "globalThis",
},
plugins: [
react(),
nodePolyfills({
include: ["process", "events", "stream", "buffer", "util"],
}),
VitePWA({
strategies: "injectManifest",
srcDir: "src",
filename: "sw.ts",
registerType: "autoUpdate",
includeAssets: ["favicon.svg"],
injectManifest: {
globPatterns: ["**/*.{js,css,html,ico,png,svg,woff2}"],
},
manifest: {
name: "AnyDrop",
short_name: "AnyDrop",
description: "Partage de fichiers instantané, peer-to-peer, sans compte",
theme_color: "#6366f1",
background_color: "#0f172a",
display: "standalone",
start_url: "/",
icons: [
{
src: "/icon-192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "/icon-512.png",
sizes: "512x512",
type: "image/png",
},
],
share_target: {
action: "/share",
method: "POST",
enctype: "multipart/form-data",
params: {
title: "title",
text: "text",
url: "url",
files: [
{
name: "files",
accept: [
"image/*",
"video/*",
"audio/*",
"application/pdf",
"application/zip",
"application/x-zip-compressed",
"text/*",
"application/msword",
"application/vnd.openxmlformats-officedocument.*",
"application/vnd.ms-excel",
"application/vnd.ms-powerpoint",
".pdf", ".zip", ".doc", ".docx", ".xls", ".xlsx",
".ppt", ".pptx", ".txt", ".csv", ".json", ".xml",
".mp3", ".mp4", ".mov", ".avi", ".mkv", ".webm",
".png", ".jpg", ".jpeg", ".gif", ".webp", ".heic", ".heif",
".svg",
],
},
],
},
} as any,
},
devOptions: {
enabled: false,
},
}),
],
server: {
port: 5173,
host: true,
},
});