forked from matrix-org/thirdroom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
75 lines (73 loc) · 1.81 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
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react";
import postcssPresetEnv from "postcss-preset-env";
import crossOriginIsolation from "vite-plugin-cross-origin-isolation";
import { serviceWorkerPlugin } from "@gautemo/vite-plugin-service-worker";
import { viteStaticCopy } from "vite-plugin-static-copy";
import path from "path";
import { mpaRouter } from "./src/vite/mpa-router";
// https://vitejs.dev/config/
export default defineConfig({
appType: "mpa",
base: "/",
server: {
port: 3000,
hmr: false,
},
plugins: [
mpaRouter(),
react(),
crossOriginIsolation(),
serviceWorkerPlugin({
filename: "sw.ts",
}),
viteStaticCopy({
targets: [
{
src: path.resolve(__dirname, "./node_modules/@webxr-input-profiles/assets/dist/profiles/**/*"),
dest: "webxr-input-profiles",
},
{
src: path.resolve(__dirname, "./node_modules/detect-gpu/dist/benchmarks/*"),
dest: "detect-gpu-benchmarks",
},
],
}),
],
resolve: {
dedupe: ["three", "bitecs"],
},
css: {
postcss: {
plugins: [
//@ts-expect-error: not sure where this type error came from, must be a package update
postcssPresetEnv({
stage: 1,
browsers: "last 2 versions",
}),
],
},
},
define: {
"import.meta.vitest": "undefined",
},
build: {
sourcemap: true,
rollupOptions: {
input: {
main: path.resolve(__dirname, "index.html"),
logviewer: path.resolve(__dirname, "logviewer/index.html"),
},
},
},
test: {
globals: true,
environment: "jsdom",
setupFiles: "./test/setup.ts",
includeSource: ["src/**/*.{ts,tsx}"],
coverage: {
all: true,
include: ["src/**/*.{ts,tsx}"],
},
},
});