-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
114 lines (109 loc) · 3.93 KB
/
Copy pathvite.config.ts
File metadata and controls
114 lines (109 loc) · 3.93 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/// <reference types="vitest/config" />
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import dts from 'vite-plugin-dts';
import { fileURLToPath, URL } from 'node:url';
//import { dirname, resolve } from 'node:path';
import Inspect from 'vite-plugin-inspect';
// VueI18nPlugin removed - no <i18n> SFC blocks are used, locales are lazy-loaded via dynamic import()
// import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
//import { VitePWA } from 'vite-plugin-pwa';
import checker from 'vite-plugin-checker';
//import * as path from 'path';
//import fs from 'fs';
/*
import vueDevTools from 'vite-plugin-vue-devtools';
*/
import Inspector from 'vite-plugin-vue-inspector';
import TurboConsole from 'unplugin-turbo-console/vite';
const isProd = process.env.NODE_ENV === 'production';
const isCI = process.env.GITHUB_ACTIONS === 'true';
/** @type {import('vite').UserConfig} */
export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
reporters: isCI ? ['default', 'github-actions', 'json', 'junit'] : ['default', 'html'],
outputFile: isCI ? { json: 'test-results.json', junit: 'test-results.xml' } : undefined,
setupFiles: ['./test/setup.ts'],
exclude: ['**/.claire/**', '**/.claude/**', '**/e2e/**', '**/node_modules/**'],
coverage: {
reporter: ['text', 'json-summary', 'html'],
},
},
plugins: [
vue({
script: {
defineModel: true,
},
}),
// VueI18nPlugin - no <i18n> SFC blocks are used, locales are lazy-loaded via dynamic import()
// VueI18nPlugin({
// include: [resolve(dirname(fileURLToPath(import.meta.url)), './src/locales/**')],
// }),
// dts generates .d.ts type declarations - only needed for library development
...(!isProd ? [dts({ insertTypesEntry: true })] : []),
checker({
vueTsc: true,
typescript: false,
}),
/*
VitePWA({
registerType: 'autoUpdate',
devOptions: {
enabled: true,
},
}), */
// Dev-only plugins: inspector, inspect, turbo-console
...(!isProd ? [Inspect(), Inspector(), TurboConsole()] : []),
],
optimizeDeps: {
include: ['jquery', 'select2'],
exclude: ['playwright', 'playwright-core', 'chromium-bidi'],
},
include: ['jquery', 'select2'],
build: {
sourcemap: false,
modulePreload: {
polyfill: true,
},
rolldownOptions: {
output: {
format: 'es',
globals: {
jquery: '$',
},
manualChunks(id) {
if (id.includes('node_modules')) {
if (id.includes('vue') || id.includes('pinia') || id.includes('vue-router') || id.includes('vue-i18n')) {
return 'framework';
}
if (id.includes('admin-lte') || id.includes('jquery') || id.includes('bootstrap') || id.includes('select2')) {
return 'legacy-ui';
}
return 'vendor';
}
if (id.includes('/src/views/')) {
const viewScope = id.split('/src/views/')[1]?.split('/')[0];
return viewScope ? `view-${viewScope}` : 'views';
}
return undefined;
},
},
},
},
resolve: {
alias: {
//'@': path.resolve(__dirname, './src'),
'@': fileURLToPath(new URL('./src', import.meta.url)),
'vue-i18n': 'vue-i18n/dist/vue-i18n.esm-bundler.js',
},
},
server: {
allowedHosts: true,
cors: true,
watch: {
ignored: ['**/.claire/**', '**/.claude/**']
}
},
});