vite.config.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* eslint-disable import/no-extraneous-dependencies */
  2. import { defineConfig } from "vite";
  3. import react from "@vitejs/plugin-react";
  4. import { VitePWA } from "vite-plugin-pwa";
  5. export default defineConfig(() => ({
  6. build: {
  7. outDir: "build",
  8. assetsDir: "static/media",
  9. sourcemap: true,
  10. },
  11. server: {
  12. port: 3000,
  13. },
  14. plugins: [
  15. react(),
  16. VitePWA({
  17. registerType: "autoUpdate",
  18. injectRegister: "inline",
  19. strategies: "injectManifest",
  20. devOptions: {
  21. enabled: true,
  22. /* when using generateSW the PWA plugin will switch to classic */
  23. type: "module",
  24. navigateFallback: "index.html",
  25. },
  26. injectManifest: {
  27. globPatterns: ["**/*.{js,css,html,mp3,png,svg,json}"],
  28. globIgnores: ["config.js"],
  29. manifestTransforms: [
  30. (entries) => ({
  31. manifest: entries.map((entry) =>
  32. entry.url === "index.html"
  33. ? {
  34. ...entry,
  35. url: "/",
  36. }
  37. : entry
  38. ),
  39. }),
  40. ],
  41. },
  42. manifest: {
  43. name: "ntfy web",
  44. short_name: "ntfy",
  45. description:
  46. "ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy.",
  47. theme_color: "#317f6f",
  48. start_url: "/",
  49. icons: [
  50. {
  51. src: "/static/images/pwa-192x192.png",
  52. sizes: "192x192",
  53. type: "image/png",
  54. },
  55. {
  56. src: "/static/images/pwa-512x512.png",
  57. sizes: "512x512",
  58. type: "image/png",
  59. },
  60. ],
  61. },
  62. }),
  63. ],
  64. }));