2023-05-24 12:24:34 +02:00
/* eslint-disable import/no-extraneous-dependencies */
import { defineConfig } from "vite" ;
import react from "@vitejs/plugin-react" ;
2023-05-24 21:36:01 +02:00
import { VitePWA } from "vite-plugin-pwa" ;
2023-05-24 12:24:34 +02:00
export default defineConfig ( ( ) => ( {
build : {
outDir : "build" ,
2023-05-25 03:44:12 +02:00
assetsDir : "static/media" ,
2023-05-24 21:36:01 +02:00
sourcemap : true ,
2023-05-24 12:24:34 +02:00
} ,
server : {
port : 3000 ,
} ,
2023-05-24 21:36:01 +02:00
plugins : [
react ( ) ,
VitePWA ( {
registerType : "autoUpdate" ,
injectRegister : "inline" ,
strategies : "injectManifest" ,
devOptions : {
2023-06-14 23:41:57 +02:00
enabled : true ,
2023-05-24 21:36:01 +02:00
/* when using generateSW the PWA plugin will switch to classic */
type : "module" ,
navigateFallback : "index.html" ,
} ,
injectManifest : {
2023-06-19 10:50:14 +02:00
globPatterns : [ "**/*.{js,css,html,mp3,ico,png,svg,json}" ] ,
2023-05-24 21:36:01 +02:00
globIgnores : [ "config.js" ] ,
manifestTransforms : [
( entries ) => ( {
manifest : entries . map ( ( entry ) =>
2023-06-19 10:50:14 +02:00
// this matches the build step in the Makefile.
// since ntfy needs the ability to serve another page on /index.html,
// it's renamed and served from server.go as app.html as well.
2023-05-24 21:36:01 +02:00
entry . url === "index.html"
? {
... entry ,
2023-06-19 10:50:14 +02:00
url : "app.html" ,
2023-05-24 21:36:01 +02:00
}
: entry
) ,
} ) ,
] ,
} ,
manifest : {
name : "ntfy web" ,
short _name : "ntfy" ,
description :
"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." ,
theme _color : "#317f6f" ,
start _url : "/" ,
icons : [
{
src : "/static/images/pwa-192x192.png" ,
sizes : "192x192" ,
type : "image/png" ,
} ,
{
src : "/static/images/pwa-512x512.png" ,
sizes : "512x512" ,
type : "image/png" ,
} ,
] ,
} ,
} ) ,
] ,
2023-05-24 12:24:34 +02:00
} ) ) ;