-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
53 lines (51 loc) · 1.15 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
/// <reference types="vitest" />
import { readFile } from "node:fs/promises";
import { builtinModules } from "node:module";
import { transform } from "esbuild";
import { defineConfig } from "vite";
import { reject } from "./.ncurc.cjs";
export default defineConfig({
build: {
target: ["node18"],
lib: {
entry: {
index: "./src/index.ts",
},
formats: ["es"],
fileName: (_, entryName) => `${entryName}.js`,
},
rollupOptions: {
external: [...reject, ...builtinModules, /^node:/],
},
},
define: {
IMPORT_JS_MODULE_WORKER: JSON.stringify(
(
await transform(
await readFile("./scripts/import-js-module-worker.ts"),
{
loader: "ts",
minify: true,
},
)
).code.trim(),
),
IMPORT_TS_MODULE_WORKER: JSON.stringify(
(
await transform(
await readFile("./scripts/import-ts-module-worker.ts"),
{
loader: "ts",
minify: true,
},
)
).code.trim(),
),
},
test: {
passWithNoTests: true,
coverage: {
provider: "istanbul",
},
},
});