-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.node.ts
56 lines (54 loc) · 1.5 KB
/
vite.config.node.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
import { resolve } from "path";
import dts from "vite-plugin-dts";
import { defineConfig } from "vitest/config";
export default defineConfig({
build: {
outDir: "dist/node",
lib: {
entry: [
resolve(__dirname, "src/index.node.ts"),
resolve(__dirname, "src/cli/browserstack-local.ts"),
resolve(__dirname, "src/cli/browserstack-app-automate.ts"),
],
fileName: (format, name) => {
const extn = (format === "es") ? "js" : "cjs";
if (name.match(/browserstack-local/)) {
return `browserstack-local.${extn}`;
} else if (name.match(/browserstack-app-automate/)) {
return `browserstack-app-automate.${extn}`;
}
return `browserstack-client.${extn}`;
},
},
rollupOptions: {
external: [/^node:/, "fs", "path", "util", "worker_threads"],
output: {
globals: {
"node:child_process": "node:child_process",
"node:fs/promises": "node:fs/promises",
"node:path": "node:path",
"node:crypto": "node:crypto",
"fs": "node:fs",
"path": "node:path",
"util": "node:util",
"worker_threads": "node:worker_threads"
},
},
},
},
plugins: [
dts({
entryRoot: "src",
exclude: ["**/__tests__/**", "**/**/openapi.json"],
outDir: "dist/types",
}),
],
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
},
},
test: {
setupFiles: ["./src/__tests__/setup.ts"],
},
});