forked from smellyshovel/vite-vue-starter-slave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.lib.config.ts
38 lines (30 loc) · 1.02 KB
/
vite.lib.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
// This config is used by the lib
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import { visualizer } from "rollup-plugin-visualizer";
import { resolve } from "path";
// https://vitejs.dev/config/
export default ({ mode }: { mode: string }) => {
// make all the Vite's env. variables available in this config file
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return defineConfig({
plugins: [vue(), visualizer()],
// TODO: uncomment and list all the direct sub-slaves (if any)
// optimizeDeps: {
// exclude: ["vite-vue-starter-slave"],
// },
build: {
outDir: "dist",
emptyOutDir: false, // can't empty because of dev:lib errors breaking the master app
lib: {
entry: resolve(__dirname, "src/main.ts"),
formats: ["es", "cjs"],
},
rollupOptions: {
// TODO: list all the peer dependencies (except for the slave itself)
external: ["vue"],
},
sourcemap: true,
},
});
};