-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
vite.config.js
49 lines (46 loc) · 943 Bytes
/
vite.config.js
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 { resolve } from "node:path";
import { defineConfig } from "vite";
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
import vue from "@vitejs/plugin-vue2";
import autoprefixer from "autoprefixer";
export default defineConfig({
build: {
lib: {
entry: resolve("src/index.js"),
name: "Tinybox",
formats: ["es", "umd"],
// Workaround to keep the old file names
fileName: (format) =>
format === "es" ? "tinybox.esm.js" : "tinybox.umd.js",
},
minify: "terser",
terserOptions: {
output: {
ecma: 6,
},
},
},
rollupOptions: {
external: ["vue"],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: "Vue",
},
},
},
plugins: [
vue({
style: {
postcssPlugins: [autoprefixer],
},
template: {
compilerOptions: {
whitespace: "condense",
},
},
}),
cssInjectedByJsPlugin(),
],
});