-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.mjs
46 lines (44 loc) · 1 KB
/
vite.config.mjs
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
const framework = process.env.FRAMEWORK;
import { resolve } from "path";
import { defineConfig } from "vite";
export default defineConfig(({ command, mode }) => {
let outputDir = "dist";
if (mode === "development") {
switch (framework) {
case "vanilla":
outputDir = "demo/vanilla/lib";
break;
case "react":
outputDir = "demo/react/src/lib";
break;
case "test":
break;
default:
throw new Error("Invalid FRAMEWORK_ENV");
}
}
return {
build: {
lib: {
entry: resolve(__dirname, "src/index.ts"),
name: "SnapLineJs",
filename: "snapline",
},
outDir: outputDir,
minify: mode === "production" ? "terser" : false,
terserOptions: {
toplevel: true,
mangle: {
properties: {
regex: /^(_|#)/,
},
},
module: true,
compress: {
drop_console: true,
drop_debugger: true,
},
},
},
};
});