-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.lib.ts
60 lines (59 loc) · 1.32 KB
/
vite.config.lib.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
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import { resolve } from 'path';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
plugins: [
vue(),
dts({
include: ['src/**/*.ts', 'src/**/*.vue'],
exclude: [
'src/App.vue',
'src/main.ts',
'src/vite-env.d.ts',
'src/router/index.ts',
'src/views/**',
'src/components/docs/**',
],
beforeWriteFile: (filePath, content) => {
const fixedContent = content.replace(
/from ['"]\.\.\/types['"];/g,
'from "../types";'
);
return {
filePath: filePath.replace('/src/', '/'),
content: fixedContent,
};
},
copyDtsFiles: true,
insertTypesEntry: true,
cleanVueFileName: true,
}),
],
build: {
outDir: 'lib',
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'VueDndHooks',
fileName: (format) => `vue-dnd-hooks.${format}.js`,
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue',
},
},
input: {
index: resolve(__dirname, 'src/index.ts'),
},
},
cssCodeSplit: false,
cssMinify: true,
},
css: {
modules: {
localsConvention: 'camelCase',
},
},
});