-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.lib.config.js
52 lines (48 loc) · 1.18 KB
/
vite.lib.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
50
51
52
import path from "path"
import { defineConfig } from "vite"
import commonjsExternals from "vite-plugin-commonjs-externals"
export default defineConfig({
resolve: {
alias: {
"~": path.resolve(__dirname, "./lib"),
},
},
plugins: [
commonjsExternals({ "externals": ["fs", "child_process", "path"] }),
],
build: {
emptyOutDir: false,
sourcemap: true,
lib: {
entry: path.resolve(__dirname, "lib/index.ts"),
name: "Confgen",
fileName: (format) => `lib.${format}.js`,
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [
"deep-equal",
"fs-extra",
"lodash",
"merge-objects",
"prettier",
"semver",
"yaml",
],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
"deep-equal": "deepequal",
"fs-extra": "fsextra",
"lodash": "lodash",
"merge-objects": "mergeobjects",
"prettier": "prettier",
"semver": "semver",
"yaml": "yaml",
},
},
},
},
})