-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
65 lines (60 loc) · 1.46 KB
/
vite.config.ts
File metadata and controls
65 lines (60 loc) · 1.46 KB
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
64
65
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
// SPDX-License-Identifier: AGPL-3.0-or-later
import path from 'node:path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import dts from 'vite-plugin-dts'
export default defineConfig(async ({ command, mode }) => {
const isDemo = command === 'serve' || mode === 'demo'
const plugins = [vue()]
if (!isDemo) {
plugins.push(
dts({
entryRoot: 'src',
outDir: 'dist',
insertTypesEntry: true,
include: ['src'],
exclude: ['examples', 'tests'],
})
)
}
if (mode === 'report') {
const { visualizer } = await import('rollup-plugin-visualizer')
plugins.push(
visualizer({
filename: 'dist/bundle-report.html',
gzipSize: true,
brotliSize: true,
open: false,
})
)
}
return {
root: isDemo ? 'examples' : undefined,
server: {
host: '0.0.0.0',
},
plugins,
build: isDemo
? {
outDir: path.resolve(__dirname, 'dist-demo'),
emptyOutDir: true,
}
: {
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'PDFElements',
formats: ['es'],
fileName: 'index',
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue',
},
},
},
},
}
})