-
Notifications
You must be signed in to change notification settings - Fork 12
/
vite.config.ts
38 lines (35 loc) · 932 Bytes
/
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
import path from 'path';
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import unocss from 'unocss/vite';
export default defineConfig(configEnv => {
const viteEnv = loadEnv(configEnv.mode, `.env.${configEnv.mode}`);
const isLib = viteEnv.VITE_LIB_MODE === '1';
return {
resolve: {
alias: {
'@': path.resolve(process.cwd(), 'src')
}
},
plugins: [vue(), unocss({ include: ['src/App.vue'] })],
build: isLib
? {
copyPublicDir: false,
lib: {
entry: path.resolve(process.cwd(), 'src/index.ts'),
name: 'SoybeanAdminLayout',
fileName: 'index',
formats: ['es', 'cjs']
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue'
}
}
}
}
: {}
};
});