-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
42 lines (40 loc) · 1.49 KB
/
Copy pathvite.config.ts
File metadata and controls
42 lines (40 loc) · 1.49 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
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";
const rootDir = dirname(fileURLToPath(import.meta.url));
const entry = {
index: resolve(rootDir, "src/index.ts"),
cleanupAutorun: resolve(rootDir, "src/cleanup/cleanupAutorun.ts"),
cleanupEventListener: resolve(rootDir, "src/cleanup/cleanupEventListener.ts"),
cleanupIdleCallback: resolve(rootDir, "src/cleanup/cleanupIdleCallback.ts"),
cleanupInterval: resolve(rootDir, "src/cleanup/cleanupInterval.ts"),
cleanupReaction: resolve(rootDir, "src/cleanup/cleanupReaction.ts"),
cleanupReactionList: resolve(rootDir, "src/cleanup/cleanupReactionList.ts"),
cleanupReactionMap: resolve(rootDir, "src/cleanup/cleanupReactionMap.ts"),
cleanupReactionPrimitiveList: resolve(rootDir, "src/cleanup/cleanupReactionPrimitiveList.ts"),
cleanupRequestAnimationFrame: resolve(rootDir, "src/cleanup/cleanupRequestAnimationFrame.ts"),
cleanupTimeout: resolve(rootDir, "src/cleanup/cleanupTimeout.ts"),
};
export default defineConfig({
build: {
emptyOutDir: false,
lib: {
entry,
formats: ["es", "cjs"],
fileName: (format, entryName) => `${entryName}.${format === "es" ? "js" : "cjs"}`,
},
rollupOptions: {
external: ["lodash", "mobx", "ms"],
output: {
exports: "named",
globals: {
lodash: "_",
mobx: "mobx",
ms: "ms",
},
},
},
sourcemap: true,
target: "es2022",
},
});