tutu/vite.config.ts
thislight 46e7f1aaea
All checks were successful
/ depoly (push) Successful in 1m30s
service worker: use injectManifest
- a RPC framework is added for further use
- fix an error that the service worker is not
    registered until the settings opened
- added theme-color
- settings: added a item to indicate the offline
    availablity
2024-10-15 20:30:08 +08:00

51 lines
1.2 KiB
TypeScript

import { defineConfig } from "vite";
import solid from "vite-plugin-solid";
import solidStyled from "vite-plugin-solid-styled";
import suid from "@suid/vite-plugin";
import { VitePWA } from "vite-plugin-pwa";
import version from "vite-plugin-package-version";
export default defineConfig(({ mode }) => ({
plugins: [
suid(),
solid(),
solidStyled({
filter: {
include: "src/**/*.{tsx,jsx}",
exclude: "node_modules/**/*.{ts,js,tsx,jsx}",
},
}),
VitePWA({
strategies: "injectManifest",
registerType: "autoUpdate",
devOptions: {
enabled: mode === "staging" || mode === "dev",
},
srcDir: "src/serviceworker",
filename: "main.ts",
manifest: {
theme_color: "#673ab7"
}
}),
version(),
],
server: {
https: {
// localhost.direct: https://github.com/Upinel/localhost.direct
key: "tools/certs/localhost.direct.key",
cert: "tools/certs/localhost.direct.crt",
passphrase: "localhost",
},
},
define: {
"import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`,
},
css: {
devSourcemap: true,
},
build: {
target: ["firefox98", "safari15.4", "ios15.4", "chrome84", "edge87"],
sourcemap: true,
},
}));