-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.mts
More file actions
47 lines (45 loc) · 1.26 KB
/
Copy pathvite.config.mts
File metadata and controls
47 lines (45 loc) · 1.26 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
import { builtinModules, createRequire } from "node:module";
import { defineConfig } from "vitest/config";
const require = createRequire(import.meta.url);
const pkg = require("./package.json");
export default defineConfig({
define: {
"process.env.PKG_VERSION": JSON.stringify(pkg.version),
},
build: {
target: "es2022",
// the published bundles have always been unminified
minify: false,
sourcemap: true,
lib: {
entry: "index.ts",
formats: ["cjs", "es"],
fileName: (format) =>
format === "cjs" ? "index.cjs.js" : "index.es.mjs",
},
rollupOptions: {
// Keep every bare import external. The previous rollup build had no
// node-resolve plugin, so anything that was not a relative import was
// left for the consumer to resolve.
external: [
/^node:/,
...builtinModules,
...Object.keys(pkg.dependencies),
...Object.keys(pkg.peerDependencies),
],
output: {
// emit require() rather than import() in the cjs bundle
dynamicImportInCjs: false,
},
},
},
test: {
coverage: {
reporter: ["lcov"],
},
testTimeout: 60000,
include: ["__tests__/**/*.test.ts"],
includeSource: ["src/**/*.ts"],
retry: 3,
},
});