-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
60 lines (59 loc) · 1.67 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
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
// https://vitejs.dev/config/
export default defineConfig({
build: {
outDir: 'dist',
lib: {
entry: resolve(__dirname, 'src/main.ts'),
name: 'VueComponents',
formats: ['es'],
fileName: (format) => `vue-components.${format}.js`,
},
sourcemap: true,
rollupOptions: {
external: ['vue', 'pinia'],
output: {
exports: 'named',
assetFileNames: (assetInfo) => {
if (assetInfo.name === 'style.css') return 'vue-components.css';
return assetInfo.name as string;
},
},
plugins: [
visualizer({
filename: 'dist/stats.html',
open: true,
}),
],
},
},
plugins: [
vue(),
VueI18nPlugin({
include: resolve(__dirname, './src/utils/i18n.json'),
}),
viteStaticCopy({
targets: [
{ src: 'src/scss/*', dest: 'scss' },
{ src: 'src/assets/*', dest: 'assets' },
],
}),
],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'@assets': resolve(__dirname, './src/assets'),
'@components': resolve(__dirname, './src/components'),
'@directives': resolve(__dirname, './src/directives'),
'@services': resolve(__dirname, './src/services'),
'@models': resolve(__dirname, './src/models'),
'@utils': resolve(__dirname, './src/utils'),
vue: 'vue/dist/vue.esm-bundler.js',
},
},
});