forked from cometchat/cometchat-uikit-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
78 lines (75 loc) · 2.12 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { defineConfig } from 'vite';
import dts from "vite-plugin-dts";
import fs from 'fs';
import path from 'path';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
const entryPoint = './src/public.api.ts';
function deleteDistFolder() {
const distPath = path.resolve(__dirname, 'dist');
if (fs.existsSync(distPath)) {
fs.rmdirSync(distPath, { recursive: true });
}
}
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
// treat all components starting with these tags as custom elements
isCustomElement: (tag) =>
tag.startsWith('cometchat-') ||
['smart-replies'].includes(tag) ||
['stickers-keyboard'].includes(tag) ||
['create-poll'].includes(tag) ||
['polls-bubble'].includes(tag) ||
['image-moderation'].includes(tag) ||
['link-preview'].includes(tag)
},
},
}),
vueJsx(),
dts({
insertTypesEntry: true,
exclude: ["**/node_modules/**/*", "**/examples/**/*"],
}),
],
base: './',
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
build: {
cssCodeSplit:false,
minify: 'esbuild',
lib: {
entry: entryPoint,
name: '@cometchat/chat-uikit-vue',
fileName: 'index',
formats: ['es', 'umd',"cjs"],
},
rollupOptions: {
output: {
globals: {
vue: 'Vue',
'@cometchat/uikit-elements': 'CometChatUIKitElements',
'@cometchat/uikit-resources': 'CometChatUIKitResources',
'@cometchat/uikit-shared': 'CometChatUIKitShared',
'@cometchat/chat-sdk-javascript': 'CometChat',
},
inlineDynamicImports: true,
},
plugins: [
{
name: 'delete-dist-folder',
buildStart() {
// Call the function to delete the dist folder
deleteDistFolder();
},
},
],
external: ['vue','@cometchat/chat-sdk-javascript','@cometchat/uikit-elements','@cometchat/uikit-resources','@cometchat/uikit-shared'],
},
},
});