-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
94 lines (90 loc) · 2.36 KB
/
vite.config.js
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import banner from 'vite-plugin-banner'
import pkg from './package.json'
// https://vitejs.dev/config/
export default defineConfig(({ command, mode, ssrBuild }) => {
if(mode === 'docs') {
return {
plugins: [
vue(),
banner({
outDir: 'docs',
content: `/*
* vue-glitched v${pkg.version}
*
* Copyright (c) 2023 lewardo (https://github.com/lewardo)
* SPDX-License-Identifier: GPL-3.0+
* _ _ _ _ _
* _ _ _ _ ___ ___ ___| |_| |_ ___| |_ ___ _| |
* | | | | | -_|___| . | | | _| _| | -_| . |
* \\_/|___|___| |_ |_|_|_| |___|_|_|___|___|
* |___|
*/`
})
],
base: '/vue-glitched/',
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
build: {
minify: true,
outDir: 'docs',
rollupOptions: {
input: {
index: resolve(__dirname, 'index.html')
},
output: {
entryFileNames: 'assets/[name].js',
chunkFileNames: 'assets/[name].js',
assetFileNames: 'assets/[name].[ext]'
}
}
}
}
} else {
return {
plugins: [
vue(),
banner({
content: `/*
* vue-glitched v${pkg.version}
*
* Copyright (c) 2023 lewardo (https://github.com/lewardo)
* SPDX-License-Identifier: GPL-3.0+
* _ _ _ _ _
* _ _ _ _ ___ ___ ___| |_| |_ ___| |_ ___ _| |
* | | | | | -_|___| . | | | _| _| | -_| . |
* \\_/|___|___| |_ |_|_|_| |___|_|_|___|___|
* |___|
*/`
})
],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
publicDir: false,
build: {
lib: {
entry: resolve(__dirname, 'src/components/index.js'),
name: 'vue-glitched',
formats: ["es", "umd"],
filename: format => `vue-glitched.${format}.js`
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue'
}
}
}
}
}
}
})