forked from AquaINFRA/InteractionPlatform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
101 lines (84 loc) · 3.1 KB
/
vite.config.ts
File metadata and controls
101 lines (84 loc) · 3.1 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// SPDX-FileCopyrightText: con terra GmbH and contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="vitest" />
import { pioneer } from "@open-pioneer/vite-plugin-pioneer";
import react from "@vitejs/plugin-react-swc";
import { resolve } from "node:path";
import { loadEnv, defineConfig, PluginOption } from "vite";
import eslint from "vite-plugin-eslint";
import { visualizer } from "rollup-plugin-visualizer";
// Minimum browser versions supported by generated JS/CSS
// See also:
// - https://vitejs.dev/config/build-options.html#build-target
// - https://esbuild.github.io/api/#target
const targets = ["chrome92", "edge92", "firefox91", "safari14"];
// Generates a stats.html in the output dir to inspect bundle sizes.
// See also: https://github.com/btd/rollup-plugin-visualizer
const visualize = false;
const sampleSites = [
"samples/api-sample",
"samples/chakra-sample",
"samples/extension-sample",
"samples/map-sample",
"samples/properties-sample",
"samples/styling-sample",
"samples/i18n-sample",
"samples/i18n-howto"
];
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const devMode = mode === "development";
// Allowed values are "DEBUG", "INFO", "WARN", "ERROR"
const logLevel = devMode ? "INFO": "WARN";
process.env = {...process.env, ...loadEnv(mode, process.cwd())};
return {
root: resolve(__dirname, "src"),
// Generates relative urls in html etc.
base: "/",
// Vite's build output is written to dist/www
build: {
outDir: resolve(__dirname, "dist/www"),
emptyOutDir: true,
target: targets
},
plugins: [
pioneer({
// Whether to include src/index.html in the built output
rootSite: true,
// Additional directories to include as html (must contain index.html files)
sites: [
"sites/onestop4all",
// Include sample sites in the build
...sampleSites
],
// Apps to distribute as .js files for embedded use cases
apps: []
}),
react(),
eslint(),
visualize &&
(visualizer({ gzipSize: true, brotliSize: true, emitFile: true }) as PluginOption)
],
// define global constants
// See also: https://vitejs.dev/config/shared-options.html#define
define: {
__LOG_LEVEL__: JSON.stringify(logLevel),
VITE_OAPIR_URL: JSON.stringify(process.env.VITE_OAPIR_URL || "https://vm4072.kaj.pouta.csc.fi/ddas/oapir")
},
// https://vitest.dev/config/
test: {
globals: true
},
server: {
proxy: {
"/solr": "http://localhost:8983"
}
}
// disable hot reloading
// in dev mode press "r" to trigger reload and make changes active
// See also: https://vitejs.dev/config/server-options.html#server-hmr
/*server: {
hmr: false
}*/
};
});