snort/packages/app/vite.config.ts

52 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-11-20 19:16:47 +00:00
import react from "@vitejs/plugin-react";
import { VitePWA } from "vite-plugin-pwa";
import { visualizer } from "rollup-plugin-visualizer";
import { defineConfig } from "vite";
2023-11-20 21:51:23 +00:00
import { vitePluginVersionMark } from "vite-plugin-version-mark";
2023-11-17 11:52:10 +00:00
import appConfig from "config";
export default defineConfig({
2023-11-20 12:22:52 +00:00
plugins: [
react(),
VitePWA({
2023-11-20 19:16:47 +00:00
strategies: "injectManifest",
srcDir: "src",
filename: "service-worker.ts",
2023-11-20 12:22:52 +00:00
devOptions: {
enabled: true,
2023-11-20 19:16:47 +00:00
type: "module",
},
2023-11-20 14:19:15 +00:00
}),
visualizer({
open: true,
gzipSize: true,
2023-11-21 08:01:23 +00:00
filename: "build/stats.html",
2023-11-20 19:16:47 +00:00
}),
2023-11-20 21:51:23 +00:00
vitePluginVersionMark({
name: "snort",
ifGitSHA: true,
command: "git describe --always --tags",
}),
2023-11-20 12:22:52 +00:00
],
2023-11-20 19:37:56 +00:00
assetsInclude: ["**/*.md", "**/*.wasm"],
2023-11-20 19:36:22 +00:00
build: {
2023-11-20 19:37:56 +00:00
outDir: "build",
2023-11-20 19:36:22 +00:00
},
2023-11-23 13:43:23 +00:00
clearScreen: false,
2023-11-21 14:21:47 +00:00
publicDir: appConfig.get("publicDir"),
2023-11-17 11:52:10 +00:00
resolve: {
alias: {
2023-11-20 19:16:47 +00:00
"@": "/src",
2023-11-17 11:52:10 +00:00
},
},
define: {
CONFIG: JSON.stringify(appConfig),
global: {}, // needed for custom-event lib
SINGLE_RELAY: JSON.stringify(process.env.SINGLE_RELAY),
},
2023-11-21 08:10:20 +00:00
test: {
globals: true,
2023-11-21 09:57:25 +00:00
environment: "jsdom",
2023-11-21 08:10:20 +00:00
},
2023-11-17 11:52:10 +00:00
});