-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathvite.config.ts
More file actions
84 lines (82 loc) · 1.9 KB
/
Copy pathvite.config.ts
File metadata and controls
84 lines (82 loc) · 1.9 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
import legacy from '@vitejs/plugin-legacy';
import react from '@vitejs/plugin-react';
import path from 'path';
import {defineConfig} from 'vite';
import eslintPlugin from 'vite-plugin-eslint2';
import svgrPlugin from 'vite-plugin-svgr';
const projectRootDir = path.resolve(__dirname);
// https://vitejs.dev/config/
export default defineConfig({
define: {
global: 'window',
// avoid "You are loading @emotion/react when it is already loaded" warnings during tests
// https://github.com/emotion-js/emotion/discussions/2795#discussioncomment-7885638
vi: {},
},
plugins: [
react({include: /\.(mdx|js|jsx|ts|tsx)$/}),
legacy(),
svgrPlugin({
svgrOptions: {
// https://react-svgr.com/docs/options/
icon: true,
},
include: ['**/*.svg?react', '**/*.svg'],
}),
eslintPlugin({
cache: true,
cacheLocation: '.eslintcache',
}),
],
resolve: {
alias: [
{
find: 'gmp',
replacement: path.resolve(projectRootDir, 'src', 'gmp'),
},
{
find: 'web',
replacement: path.resolve(projectRootDir, 'src', 'web'),
},
{
find: 'version',
replacement: path.resolve(projectRootDir, 'src', 'version.ts'),
},
{
find: '@gsa/testing',
replacement: path.resolve(projectRootDir, 'src', 'testing.ts'),
},
],
},
server: {
port: 8080,
host: '127.0.0.1',
fs: {
strict: true,
allow: ['index.html', 'src', 'node_modules'],
},
},
preview: {
port: 8080,
host: '127.0.0.1',
},
build: {
outDir: 'build',
rolldownOptions: {
output: {
minify: {
compress: true,
mangle: false,
},
codeSplitting: {
groups: [
{
name: 'greenbone-ui-lib',
test: /greenbone[/\\]ui-lib/,
},
],
},
},
},
},
});