-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
62 lines (58 loc) · 1.43 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
/// <reference types="vitest" />
import { defineConfig, loadEnv } from "vite";
import { fileURLToPath, URL } from "url";
export default defineConfig(({ mode }) => {
// Get only have VITE_ prefix env variables
process.env = {
...process.env,
...loadEnv(mode, fileURLToPath(new URL(".", import.meta.url)), "VITE_"),
};
return {
build: {
rollupOptions: {
preserveEntrySignatures: "allow-extension",
input: ["src/index.ts"],
output: [
{
entryFileNames: "[name].[format].js",
format: "es",
preserveModules: true,
},
{
entryFileNames: "[name].[format].js",
format: "cjs",
preserveModules: true,
},
{
entryFileNames: "[name].[format].js",
format: "iife",
},
{
entryFileNames: "[name].[format].js",
format: "umd",
},
],
},
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
// https://vitest.dev/config/#configuring-vitest
test: {
globals: true,
coverage: {
all: true,
functions: 95,
lines: 95,
statements: 95,
branches: 95,
excludeNodeModules: true,
include: ["src"],
exclude: ["src/manipulate/index.ts"],
clean: true,
},
},
};
});