-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
vite.config.ts
63 lines (61 loc) · 1.35 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
63
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import banner from 'vite-plugin-banner'
import pkg from './package.json'
const outDir = 'lib'
// https://cn.vitejs.dev/config/
export default defineConfig({
build: {
outDir,
lib: {
entry: 'src/index.tsx',
name: 'vuePictureCropper',
formats: ['es', 'cjs', 'umd'],
fileName: (format) => {
switch (format) {
case 'es':
return 'index.mjs'
case 'cjs':
return 'index.cjs'
default:
return 'index.min.js'
}
},
},
minify: true,
sourcemap: false,
rollupOptions: {
external: Object.keys(pkg.peerDependencies),
output: {
exports: 'named',
globals: {
vue: 'Vue',
},
},
},
},
resolve: {
dedupe: [
...Object.keys(pkg.dependencies),
...Object.keys(pkg.peerDependencies),
],
},
plugins: [
vue(),
vueJsx(),
banner({
outDir,
content: [
`/**`,
` * name: ${pkg.name}`,
` * version: v${pkg.version}`,
` * description: ${pkg.description}`,
` * author: ${pkg.author}`,
` * homepage: ${pkg.homepage}`,
` * license: ${pkg.license}`,
` */`,
].join('\n'),
}),
],
})