-
Notifications
You must be signed in to change notification settings - Fork 97
/
vite.config.ts
68 lines (66 loc) · 1.63 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
61
62
63
64
65
66
67
68
/// <reference types="vitest" />
import path from 'path';
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import legacy from '@vitejs/plugin-legacy';
import svgrPlugin from 'vite-plugin-svgr';
import eslintPlugin from 'vite-plugin-eslint2';
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(),
],
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.js'),
},
{
find: '@gsa/testing',
replacement: path.resolve(projectRootDir, 'src', 'testing.js'),
},
],
},
server: {
port: 8080,
},
build: {
outDir: 'build',
minify: 'terser',
terserOptions: {
mangle: false,
},
rollupOptions: {
output: {
manualChunks: {
'opensight-ui': ['@greenbone/opensight-ui-components-mantinev7'],
},
},
},
},
});