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",
|
2024-03-07 17:08:51 +00:00
|
|
|
injectRegister: "inline",
|
2023-11-20 19:16:47 +00:00
|
|
|
srcDir: "src",
|
|
|
|
filename: "service-worker.ts",
|
2024-03-07 17:08:51 +00:00
|
|
|
registerType: "autoUpdate",
|
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-12-11 11:36:14 +00:00
|
|
|
ifMeta: false,
|
2024-01-30 22:04:19 +00:00
|
|
|
ifLog: 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 },
|
2024-01-19 13:38:37 +00:00
|
|
|
sourcemap: 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
|
|
|
|
},
|
2024-01-09 09:28:48 +00:00
|
|
|
worker: {
|
2024-03-07 14:12:50 +00:00
|
|
|
format: "es",
|
2024-01-09 09:28:48 +00:00
|
|
|
},
|
2023-11-17 11:52:10 +00:00
|
|
|
});
|