-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.mts
64 lines (63 loc) · 1.66 KB
/
vite.config.mts
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
import vue from '@vitejs/plugin-vue'
import * as path from 'path'
import typescript2 from 'rollup-plugin-typescript2'
import { defineConfig } from 'vite'
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
import dts from 'vite-plugin-dts'
import vuetify from 'vite-plugin-vuetify'
export default defineConfig({
plugins: [
vue(),
vuetify(),
dts({
insertTypesEntry: true
}),
cssInjectedByJsPlugin(),
typescript2({
check: false,
include: ['src/components/**/*.vue'],
tsconfigOverride: {
compilerOptions: {
outDir: 'dist',
sourceMap: true,
declaration: true,
declarationMap: true
}
},
exclude: ['vite.config.mts']
})
],
build: {
cssCodeSplit: true,
lib: {
// Could also be a dictionary or array of multiple entry points
entry: 'src/main.ts',
name: 'reevFrontendLib',
formats: ['umd', 'es', 'cjs'], // order is important, see: https://github.com/rollup/rollup/issues/5095#issuecomment-1683264619
fileName: (format) => `reev-frontend-lib.${format}.js`
},
rollupOptions: {
// make sure to externalize deps that should not be bundled
// into your library
input: {
main: path.resolve(__dirname, 'src/main.ts')
},
external: ['vue'],
output: {
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'main.css') return 'reev-frontend-lib.css'
return assetInfo.name
},
exports: 'named',
globals: {
vue: 'Vue'
}
}
}
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
}
})