iaiuse commited on
Commit
54a8436
1 Parent(s): 6b1e987

Create vite.config.ts

Browse files
Files changed (1) hide show
  1. vite.config.ts +116 -0
vite.config.ts ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { resolve } from 'node:path';
2
+ import { URL, fileURLToPath } from 'node:url';
3
+
4
+ import VueI18n from '@intlify/unplugin-vue-i18n/vite';
5
+ import vue from '@vitejs/plugin-vue';
6
+ import vueJsx from '@vitejs/plugin-vue-jsx';
7
+ import Unocss from 'unocss/vite';
8
+ import AutoImport from 'unplugin-auto-import/vite';
9
+ import IconsResolver from 'unplugin-icons/resolver';
10
+ import Icons from 'unplugin-icons/vite';
11
+ import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
12
+ import Components from 'unplugin-vue-components/vite';
13
+ import { defineConfig } from 'vite';
14
+ import { VitePWA } from 'vite-plugin-pwa';
15
+ import markdown from 'vite-plugin-vue-markdown';
16
+ import svgLoader from 'vite-svg-loader';
17
+ import { configDefaults } from 'vitest/config';
18
+
19
+ const baseUrl = process.env.BASE_URL ?? '/';
20
+
21
+ // https://vitejs.dev/config/
22
+ export default defineConfig({
23
+ plugins: [
24
+ VueI18n({
25
+ runtimeOnly: true,
26
+ jitCompilation: true,
27
+ compositionOnly: true,
28
+ fullInstall: true,
29
+ strictMessage: false,
30
+ include: [
31
+ resolve(__dirname, 'locales/**'),
32
+ ],
33
+ }),
34
+ AutoImport({
35
+ imports: [
36
+ 'vue',
37
+ 'vue-router',
38
+ '@vueuse/core',
39
+ 'vue-i18n',
40
+ {
41
+ 'naive-ui': ['useDialog', 'useMessage', 'useNotification', 'useLoadingBar'],
42
+ },
43
+ ],
44
+ vueTemplate: true,
45
+ eslintrc: {
46
+ enabled: true,
47
+ },
48
+ }),
49
+ Icons({ compiler: 'vue3' }),
50
+ vue({
51
+ include: [/\.vue$/, /\.md$/],
52
+ }),
53
+ vueJsx(),
54
+ markdown(),
55
+ svgLoader(),
56
+ VitePWA({
57
+ registerType: 'autoUpdate',
58
+ strategies: 'generateSW',
59
+ manifest: {
60
+ name: 'IT Tools',
61
+ description: 'Aggregated set of useful tools for developers.',
62
+ display: 'standalone',
63
+ lang: 'fr-FR',
64
+ start_url: `${baseUrl}?utm_source=pwa&utm_medium=pwa`,
65
+ orientation: 'any',
66
+ theme_color: '#18a058',
67
+ background_color: '#f1f5f9',
68
+ icons: [
69
+ {
70
+ src: '/favicon-16x16.png',
71
+ type: 'image/png',
72
+ sizes: '16x16',
73
+ },
74
+ {
75
+ src: '/favicon-32x32.png',
76
+ type: 'image/png',
77
+ sizes: '32x32',
78
+ },
79
+ {
80
+ src: '/android-chrome-192x192.png',
81
+ sizes: '192x192',
82
+ type: 'image/png',
83
+ },
84
+ {
85
+ src: '/android-chrome-512x512.png',
86
+ sizes: '512x512',
87
+ type: 'image/png',
88
+ purpose: 'any maskable',
89
+ },
90
+ ],
91
+ },
92
+ }),
93
+ Components({
94
+ dirs: ['src/'],
95
+ extensions: ['vue', 'md'],
96
+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
97
+ resolvers: [NaiveUiResolver(), IconsResolver({ prefix: 'icon' })],
98
+ }),
99
+ Unocss(),
100
+ ],
101
+ base: baseUrl,
102
+ resolve: {
103
+ alias: {
104
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
105
+ },
106
+ },
107
+ define: {
108
+ 'import.meta.env.PACKAGE_VERSION': JSON.stringify(process.env.npm_package_version),
109
+ },
110
+ test: {
111
+ exclude: [...configDefaults.exclude, '**/*.e2e.spec.ts'],
112
+ },
113
+ build: {
114
+ target: 'esnext',
115
+ },
116
+ });