-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
104 lines (99 loc) · 3.23 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/// <reference types="vitest" />
/* eslint-disable import/no-extraneous-dependencies */
import copy from 'rollup-plugin-copy'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import * as path from 'path'
// const resolvePath = (str: string) => path.resolve(__dirname, str)
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag: string) => tag.startsWith('ce-'),
},
},
}),
vueJsx(),
dts(),
],
resolve: {
alias: {
'@': path.join(__dirname, './src'),
},
},
build: {
lib: {
name: 'Cresh-UI',
entry: {
'.': path.resolve(__dirname, 'src/index.ts'),
ui: path.resolve(__dirname, 'src/components/ui/index.ts'),
icons: path.resolve(__dirname, 'src/components/icons/index.ts'),
'form-controls': path.resolve(__dirname, 'src/components/form-controls/index.ts'),
directives: path.resolve(__dirname, 'src/directives/index.ts'),
helpers: path.resolve(__dirname, 'src/helpers/index.ts'),
plugins: path.resolve(__dirname, 'src/plugins/index.ts'),
},
fileName: (format: string, entryName: string) => `${entryName === '.'
? 'cresh-ui'
: entryName}.${format}.js`,
formats: ['es', 'cjs'],
},
rollupOptions: {
external: ['vue'],
output: {
// Provide global variables to use in the UMD build
// Add external deps here
globals: {
vue: 'Vue',
},
},
plugins: [
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
copy({
targets: [
{ src: './src/styles/ui/c-notify.scss', dest: './dist/sass' },
{ src: './src/styles/ui/c-date-picker.scss', dest: './dist/sass' },
{ src: './src/styles/preprocessor/fonts.scss', dest: './dist/sass' },
{ src: './src/styles/preprocessor/break-points.scss', dest: './dist/sass' },
{ src: './src/styles/preprocessor/computeds.scss', dest: './dist/sass' },
{ src: './src/styles/preprocessor/utils.scss', dest: './dist/sass' },
{ src: './src/styles/themes/default-theme.css', dest: './dist' },
{ src: './src/@types/cresh-ui.d.ts', dest: './dist' },
{ src: './src/@types/c-datatable.d.ts', dest: './dist' },
{ src: './src/@types/c-notify.d.ts', dest: './dist' },
],
verbose: true,
copyOnce: true,
hook: 'writeBundle',
}),
],
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `
@import "./src/styles/preprocessor/fonts.scss";
@import "./src/styles/preprocessor/break-points.scss";
@import "./src/styles/preprocessor/computeds.scss";
@import "./src/styles/preprocessor/utils.scss";
@import "./src/styles/preprocessor/default-colors.scss";
`,
},
},
},
server: {
host: '0.0.0.0',
port: 8085,
},
define: {
__VUE_I18N_FULL_INSTALL__: false,
__VUE_I18N_LEGACY_API__: false,
__INTLIFY_PROD_DEVTOOLS__: false,
},
})