Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
91 lines (89 loc) · 2.91 KB
/
Copy pathvite.config.ts
File metadata and controls
91 lines (89 loc) · 2.91 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
import { defineConfig } from "vite-plus";
const minifyOptions = {
compress: true,
// Keep class/function names during minification. Bundled deps such as
// @actions/cache branch on `error.name === SomeError.name` (e.g.
// ReserveCacheError). Plain `minify: true` mangles the class binding, so
// `SomeError.name` becomes the mangled identifier and never matches the
// instance's preserved `this.name` literal — routing benign errors (like a
// cache reserve race in a build matrix) to core.warning instead of core.info.
mangle: { keepNames: { function: true, class: true } },
};
export default defineConfig({
test: {
include: ["src/**/*.test.ts"],
// PowerShell and Git Bash subprocesses can exceed five seconds on Windows
// CI runners. Allow startup overhead beyond the subprocess timeout.
testTimeout: process.platform === "win32" ? 15_000 : 5_000,
},
staged: {
"*": "vp check --fix",
},
// Build each entry independently so the portable CI runtimes remain
// standalone files. A shared chunk would not be present when GitLab or
// Azure downloads only its entrypoint from raw.githubusercontent.com.
pack: [
{
entry: { index: "./src/index.ts" },
format: ["esm"],
outDir: "dist",
deps: { alwaysBundle: [/.*/], onlyBundle: false },
clean: true,
minify: minifyOptions,
},
{
entry: { "gitlab/index": "./src/gitlab/index.ts" },
format: ["esm"],
outDir: "dist",
deps: { alwaysBundle: [/.*/], onlyBundle: false },
clean: false,
minify: minifyOptions,
},
{
entry: { "azure/index": "./src/azure/index.ts" },
format: ["esm"],
outDir: "dist",
deps: { alwaysBundle: [/.*/], onlyBundle: false },
clean: false,
minify: minifyOptions,
},
],
lint: {
jsPlugins: ["@e18e/eslint-plugin"],
ignorePatterns: ["dist/**/*"],
options: {
typeAware: true,
typeCheck: true,
},
rules: {
// Enable rules that work without TypeScript ESLint's type services.
"e18e/prefer-array-at": "error",
"e18e/prefer-array-fill": "error",
"e18e/prefer-includes": "error",
"e18e/prefer-array-to-reversed": "error",
"e18e/prefer-array-to-sorted": "error",
"e18e/prefer-array-to-spliced": "error",
"e18e/prefer-nullish-coalescing": "error",
"e18e/prefer-object-has-own": "error",
"e18e/prefer-url-canparse": "error",
"e18e/prefer-array-from-map": "error",
"e18e/prefer-timer-args": "error",
"e18e/prefer-date-now": "error",
"e18e/prefer-regex-test": "error",
"e18e/prefer-array-some": "error",
"e18e/prefer-static-regex": "error",
"e18e/prefer-string-fromcharcode": "error",
},
overrides: [
{
files: ["**/*.test.ts", "test/**"],
rules: {
"e18e/prefer-static-regex": "off",
},
},
],
},
fmt: {
ignorePatterns: ["dist/**/*"],
},
});