/
vite.config.ts
60 lines (57 loc) · 1.44 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
// vite.config.js
import { defineConfig } from 'vite';
import dynamicImportVars from '@rollup/plugin-dynamic-import-vars';
import path from 'path';
import vue from '@vitejs/plugin-vue';
import typescript2 from 'rollup-plugin-typescript2';
import Components from 'unplugin-vue-components/vite';
import vueJsx from '@vitejs/plugin-vue-jsx';
const resolvePath = (str: string) => path.resolve(__dirname, str);
export default defineConfig({
plugins: [
vue(),
vueJsx(),
Components({
dirs: ['src/components/primitives'],
exclude: [/node_modules/],
}),
typescript2({
check: false,
include: ['src/components/*.vue', 'src/components/primitives/*.vue'],
tsconfigOverride: {
compilerOptions: {
sourceMap: true,
declaration: true,
declarationMap: true,
},
exclude: ['vite.config.ts', '__tests__'],
},
}),
],
resolve: {
alias: [
{
find: './runtimeConfig',
replacement: './runtimeConfig.browser',
},
],
},
build: {
cssCodeSplit: false,
lib: {
entry: resolvePath('./src/index.ts'),
formats: ['es', 'cjs'],
name: 'ui-vue',
fileName: (format) => (format === 'es' ? 'index.js' : `index.${format}`),
},
rollupOptions: {
plugins: [dynamicImportVars],
external: ['aws-amplify', 'vue'],
output: {
globals: {
vue: 'Vue',
},
},
},
},
});