-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
49 lines (47 loc) · 1.41 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
import fs from "node:fs";
import { resolve } from "path";
import { defineConfig, createLogger } from "vite";
import dts from "vite-plugin-dts";
const logger = createLogger();
export default defineConfig({
build: {
lib: {
entry: {
index: resolve(__dirname, "libs/index.ts"),
asyncStorage: resolve(__dirname, "libs/asyncStorage.ts"),
syncStorage: resolve(__dirname, "libs/syncStorage.ts"),
cookie: resolve(__dirname, "libs/engine/cookie.ts"),
localStorage: resolve(__dirname, "libs/engine/localStorage.ts"),
indexedDB: resolve(__dirname, "libs/engine/indexedDB.ts"),
},
name: "AsyncStorage",
},
rollupOptions: {
external: [],
},
},
plugins: [
{
name: "vite-plugin-copy",
enforce: "post",
closeBundle() {
logger.info("Copying package.json to dist/package.json");
fs.copyFileSync(
resolve(__dirname, "package.json"),
resolve(__dirname, "dist/package.json")
);
logger.info("Copying LICENSE to dist/LICENSE");
fs.copyFileSync(
resolve(__dirname, "LICENSE"),
resolve(__dirname, "dist/LICENSE")
);
logger.info("Copying README.md to dist/README.md");
fs.copyFileSync(
resolve(__dirname, "README.md"),
resolve(__dirname, "dist/README.md")
);
},
},
dts({ rollupTypes: true }),
],
});