-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvite.config.ts
56 lines (54 loc) · 1.57 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
import { fileURLToPath, URL } from 'node:url';
import { dirname, resolve } from 'node:path';
import { defineConfig, splitVendorChunkPlugin, type Plugin } from 'vite';
import vue from '@vitejs/plugin-vue';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import vueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import topLevelAwait from 'vite-plugin-top-level-await';
import { VitePWA } from 'vite-plugin-pwa';
import { visualizer } from 'rollup-plugin-visualizer';
import { version } from './package.json';
process.env.VITE_APP_VERSION = version;
export default defineConfig({
base: './',
plugins: [
vue(),
createSvgIconsPlugin({
iconDirs: [resolve(process.cwd(), 'src/assets/icon')],
}),
vueI18nPlugin({
include: resolve(dirname(fileURLToPath(import.meta.url)), 'src/locales/**'),
}),
topLevelAwait({
promiseExportName: '__tla',
promiseImportName: (index: number) => `__tla_${index}`,
}),
VitePWA({ registerType: 'autoUpdate' }),
splitVendorChunkPlugin(),
visualizer({ gzipSize: true }) as unknown as Plugin<any>,
],
server: {
port: 8080,
},
esbuild: {
pure: ['console.log'],
drop: ['debugger'],
},
resolve: {
alias: {
'@': fileURLToPath(new URL('src', import.meta.url)),
},
},
build: {
rollupOptions: {
output: {
chunkFileNames: 'chunks/[name]-[hash].js',
manualChunks: filepath => {
if (filepath.includes('@component-hook/pdf-canvas')) {
return '@component-hook/pdf-canvas';
}
},
},
},
},
});