-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
84 lines (82 loc) · 2.1 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { fileURLToPath, URL } from "node:url"
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import postcssPresetEnv from "postcss-preset-env"
import styleInject from "@senojs/rollup-plugin-style-inject"
import { visualizer } from "rollup-plugin-visualizer"
// https://vitejs.dev/config/
export default () => {
return defineConfig({
plugins: [
vue(),
styleInject({
insertAt: "top"
}),
visualizer({
filename: "stats.html",
gzipSize: true
})
],
css: {
postcss: {
plugins: [postcssPresetEnv()]
}
},
build: {
lib:
process.env.NODE_ENV === "production"
? {
entry: fileURLToPath(new URL("src/hy-vue-gantt.ts", import.meta.url)),
name: "HyVueGantt",
fileName: "hy-vue-gantt"
}
: undefined,
outDir: process.env.NODE_ENV === "production" ? "lib" : "dist",
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into the library
external: [
"vue",
"dayjs",
"date-holidays",
/^dayjs\/plugin/,
/^dayjs\/locale/,
"@fortawesome/vue-fontawesome",
"@fortawesome/free-solid-svg-icons",
"@vueuse/core"
],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: "Vue",
dayjs: "dayjs",
"date-holidays": "date-holidays"
},
exports: "named"
}
},
minify: "terser",
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
pure_funcs: ["console.log", "console.info", "console.debug"],
passes: 2,
pure_getters: true,
unsafe_math: true,
unsafe_methods: true
},
mangle: {
safari10: true,
properties: {
regex: /^_/
}
},
format: {
comments: false
}
}
}
})
}