forked from mbeckem/github-actions-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
72 lines (59 loc) · 2.19 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
// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)
// 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 { defineConfig } from "vite";
import eslint from "vite-plugin-eslint";
// 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"];
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const devMode = mode === "development";
// Allowed values are "DEBUG", "INFO", "WARN", "ERROR"
const logLevel = devMode ? "INFO" : "WARN";
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/map"],
// Apps to distribute as .js files for embedded use cases
apps: []
}),
react(),
eslint()
],
// define global constants
// See also: https://vitejs.dev/config/shared-options.html#define
define: {
__LOG_LEVEL__: JSON.stringify(logLevel)
},
// https://vitest.dev/config/
test: {
globals: true,
environment: "happy-dom",
setupFiles: ["testing/global-setup.ts"]
}
// 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
}*/
};
});