-
-
Notifications
You must be signed in to change notification settings - Fork 556
/
Copy pathvite.config.ts
58 lines (50 loc) · 1.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
/* SPDX-FileCopyrightText: 2014-present Kriasoft */
/* SPDX-License-Identifier: MIT */
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
import { loadEnv } from "envars";
import { resolve } from "node:path";
import { defineProject } from "vitest/config";
/**
* Vite configuration.
* @see https://vitejs.dev/config/
*/
export default defineProject(async ({ mode }) => {
// Load environment variables from `.env` files
// https://vitejs.dev/config/#using-environment-variables-in-config
await loadEnv(mode, {
root: "..",
schema: "./core/env.ts",
mergeTo: process.env,
});
return {
cacheDir: "../.cache/vite-api",
build: {
ssr: "./index.ts",
emptyOutDir: true,
sourcemap: "inline",
},
ssr: {},
plugins: [
viteCommonjs({
include: ["graphql-relay"],
}),
],
server: {
port: 8080,
deps: {
inline: ["graphql", "graphql-relay"],
},
},
test: {
...{ cache: { dir: resolve(__dirname, "../.cache/vitest") } },
environment: "node",
testTimeout: 10000,
teardownTimeout: 10000,
server: {
deps: {
inline: ["graphql", "graphql-relay"],
},
},
},
};
});