-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
86 lines (81 loc) · 2.22 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { fileURLToPath, URL } from "node:url";
import { defineConfig, mergeConfig } from "vite";
import { defineConfig as defineVitestConfig } from "vitest/config";
import viteCompression from "vite-plugin-compression";
import vue from "@vitejs/plugin-vue";
const parsePort = (port: string) => {
return parseInt(port) ? parseInt(port) : 8080;
};
const cacheDir =
process.env.NODE_ENV === "development-docker"
? "/app/node_modules/.vite"
: "../node_modules/.vite";
// https://vitejs.dev/config/
const viteConfig = defineConfig({
plugins: [vue(), viteCompression()],
define: {
__VUE_I18N_FULL_INSTALL__: true,
__VUE_I18N_LEGACY_API__: false,
__INTLIFY_PROD_DEVTOOLS__: false,
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: true,
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
dedupe: ["vue"],
},
server: {
host: "0.0.0.0",
port: parsePort("8080"),
hmr: {
clientPort: parsePort(process.env.PROJECT_PORT || "8000"),
},
watch: {
usePolling: true,
},
},
cacheDir,
build: {
sourcemap: false,
minify: "esbuild",
rollupOptions: {
external: ["pdfjs-dist/types/src/display/api"],
output: {
manualChunks: {
vue: ["vue", "vue-router"],
apollo: ["@apollo/client", "@vue/apollo-composable"],
leaflet: ["leaflet", "@vue-leaflet/vue-leaflet"],
sentry: [
"@sentry/browser",
"@sentry/integrations",
"@sentry/tracing",
"@sentry/vue",
],
openseadragon: ["openseadragon"],
pdfjs: ["pdfjs-dist"],
ol: ["ol"],
chart: [
"chart.js",
"chartjs-adapter-date-fns",
"chartjs-plugin-datasource-prometheus",
],
openlayers: ["vue3-openlayers"],
dropzone: ["dropzone"],
unicons: ["vue-unicons"],
},
},
},
},
optimizeDeps: {
exclude: ["session-vue-3-oidc-library", "date-fns"],
include: ["vue", "@vue/runtime-core"],
},
});
const vitestConfig = defineVitestConfig({
test: {
setupFiles: "./vitestSetup.ts",
environment: "jsdom",
},
});
export default mergeConfig(viteConfig, vitestConfig);