snort/packages/app/vite.config.ts

63 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-11-20 19:16:47 +00:00
import react from "@vitejs/plugin-react";
2024-01-04 17:01:18 +00:00
import appConfig from "config";
2023-11-20 19:16:47 +00:00
import { visualizer } from "rollup-plugin-visualizer";
import { defineConfig } from "vite";
2024-01-04 17:01:18 +00:00
import { VitePWA } from "vite-plugin-pwa";
2023-11-20 21:51:23 +00:00
import { vitePluginVersionMark } from "vite-plugin-version-mark";
2023-11-17 11:52:10 +00:00
export default defineConfig({
2023-11-20 12:22:52 +00:00
plugins: [
2024-01-08 08:27:26 +00:00
react({
jsxImportSource: "@welldone-software/why-did-you-render",
}),
2023-11-20 12:22:52 +00:00
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",
},
2024-01-10 12:07:44 +00:00
workbox: {
2024-01-10 13:40:40 +00:00
globPatterns: ["**/*.{js,html,wasm,woff,woff2,ttf,svg,png,jpg,jpeg,webp,ico,json}"],
2024-01-10 12:07:44 +00:00
sourcemap: true,
2024-01-10 13:40:40 +00:00
},
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-12-11 11:36:14 +00:00
ifMeta: false,
2023-11-20 21:51:23 +00:00
}),
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",
2024-01-09 09:28:48 +00:00
commonjsOptions: { transformMixedEsModules: true },
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
},
2024-01-09 09:28:48 +00:00
worker: {
format: "es",
},
2023-11-17 11:52:10 +00:00
});