forked from dolanmiu/docx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
69 lines (64 loc) · 1.79 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
import { defineConfig } from "vitest/config";
import { resolve } from "path";
import tsconfigPaths from "vite-tsconfig-paths";
import dts from "vite-plugin-dts";
import { nodePolyfills } from "vite-plugin-node-polyfills";
export default defineConfig({
plugins: [
tsconfigPaths(),
dts(),
nodePolyfills({
exclude: [],
globals: {
Buffer: false,
},
protocolImports: true,
}),
],
resolve: {
alias: {
"@util/": `${resolve(__dirname, "src/util")}/`,
"@export/": `${resolve(__dirname, "src/export")}/`,
"@file/": `${resolve(__dirname, "src/file")}/`,
"@shared": `${resolve(__dirname, "src/shared")}`,
},
},
build: {
minify: false,
lib: {
entry: [resolve(__dirname, "src/index.ts")],
name: "docx",
fileName: (d) => {
if (d === "umd") {
return "index.umd.js";
}
if (d === "cjs") {
return "index.cjs";
}
if (d === "es") {
return "index.mjs";
}
if (d === "iife") {
return "index.iife.js";
}
return "unknown";
},
formats: ["iife", "es", "cjs", "umd"],
},
outDir: resolve(__dirname, "build"),
commonjsOptions: {
include: [/node_modules/],
},
},
test: {
environment: "jsdom",
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
statements: 99.93,
branches: 98.85,
functions: 100,
lines: 99.93,
},
},
});