-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite-web-config.ts
50 lines (49 loc) · 1.1 KB
/
vite-web-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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
if (command === 'serve' || command === 'dev') {
return {
plugins: [
vue({
template: {
compilerOptions: {
// treat all tags with a dash as custom elements
isCustomElement: tag => tag.includes('-')
}
}
})
],
}
} else {
// command === 'build'
return {
plugins: [
vue({
customElement: true,
template: {
compilerOptions: {
isCustomElement: tag => tag.includes('-')
}
}
})
],
build: {
lib: {
entry: 'src/web/web.ts',
name: 'TedirSelect',
fileName: (format) => `tedir-select-web.${format}.js`
},
outDir: 'dist/web',
/*rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue'
}
}
}*/
}
}
}
})