-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
75 lines (72 loc) · 2.5 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
import { defineConfig, type UserConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path, { resolve } from 'path'
import typescript2 from 'rollup-plugin-typescript2'
import dts from 'vite-plugin-dts'
import { svgSpritePlugin } from '@foodsoul/vite-svg-sprite-plugin'
import { fileURLToPath, URL } from 'node:url'
import AutoImport from 'unplugin-auto-import/vite'
import { AutoImportOptions } from './pluguins/auto-import-options'
// https://vitejs.dev/config/
export default defineConfig(() => {
const config: UserConfig = {
plugins: [
dts({
pathsToAliases: false
}),
vue(),
AutoImport(AutoImportOptions),
svgSpritePlugin({
originalIconsDirectory: path.resolve(process.cwd(), 'src/assets/icons'),
outputDirectory: path.resolve(process.cwd(), 'src/assets')
}),
typescript2({
check: false,
tsconfigOverride: {
compilerOptions: {
sourceMap: true,
declaration: true,
declarationMap: true
}
}
})
],
resolve: {
alias: [
{
find: '~',
replacement: fileURLToPath(new URL('./src', import.meta.url))
}
]
},
build: {
/** TODO: можно включить, но тогда надо позаботиться о импорте css чанков */
cssCodeSplit: false,
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'src/main.ts'),
formats: ['es']
},
manifest: true,
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [
'vue',
'@vueuse/core',
'vue-router',
/src\/App.vue/ // exclude App.vue component
],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: 'Vue'
},
preserveModules: true
}
}
}
}
return config
})