-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
62 lines (62 loc) · 1.81 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
import vue from '@vitejs/plugin-vue';
import path from 'path';
import copy from 'rollup-plugin-copy';
import { defineConfig } from 'vite';
// import vitePluginInspect from 'vite-plugin-inspect';
// https://vitejs.dev/config/
export default defineConfig({
// 生产配置
base: './',
build: {
outDir: './dist/minivuebarrage',
lib: {
entry: path.resolve(__dirname, './packages/components/index.ts'), // 指定生产打包 入口
name: 'minivuebarrage', // 打包完成的名称
formats: ['es' , 'cjs'], // 打包的 输出的 模式
fileName: (ModuleFormat) => {
if(ModuleFormat === 'es'){
return `${ModuleFormat}/index.mjs`
}else{
return `lib/index.js`
}
}
},
rollupOptions: {
output:{
// 设置静态资源输出目录
assetFileNames: `lib/index.css`,
},
external: ['vue'],
}
},
resolve: {
alias:{
"@" : path.resolve(__dirname , './src'),
"@p": path.resolve(__dirname , './packages')
}
},
plugins: [
vue(),
copy({
hook: "closeBundle",
targets: [
{ src: 'packages/package.json', dest: 'dist/minivuebarrage/' },
{
src: 'packages/components/minivueBarrage/docs/README.md', dest: 'dist/minivuebarrage/'
},
{
src: 'packages/components/minivueBarrage/index.d.ts', dest: 'dist/minivuebarrage/lib/'
},
{
src: 'packages/components/minivueBarrage/index.d.ts', dest: 'dist/minivuebarrage/es/'
}
],
}),
],
server:{
host: '0.0.0.0',
port: 8080,
open: true
}
}
)