tutu/vite.config.ts
2024-10-22 17:48:17 +08:00

53 lines
1.3 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";
import manifest from "./manifest.config";
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: manifest,
pwaAssets: {
config: true,
},
}),
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,
},
}));