-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathvite.config.ts
57 lines (53 loc) · 1.48 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
/*
* Copyright The OpenZipkin Authors
* SPDX-License-Identifier: Apache-2.0
*/
/// <reference types="vitest" />
import {defineConfig, UserConfig} from 'vite'
import * as path from "path";
// baseUrl is the default path to lookup assets.
const baseUrl = process.env.BASE_URL || '/zipkin';
const zipkinProxyConfig = {
target: process.env.API_BASE || 'http://localhost:9411',
changeOrigin: true,
};
export default defineConfig(():UserConfig => {
// https://vitejs.dev/config/
return {
server: {
port: 3000,
proxy: {
'/zipkin/api/v2': zipkinProxyConfig,
'/zipkin/config.json': zipkinProxyConfig,
},
},
resolve: {
alias: {
src: path.resolve('src/'),
},
},
// @ts-ignore
test: {
environment: 'happy-dom'
},
base: baseUrl,
build: {
outDir: 'build',
// use the same path patterns as the original react-scripts lens build
assetsDir: "static",
// uncomment to build with sourcemap, for troubleshooting zipkin-server
// sourcemap: true,
rollupOptions: {
output: {
assetFileNames({name}):string {
if (name?.includes('.css')) return 'static/css/[name].[hash].css'
if (name?.includes('.png')) return 'static/media/[name].[hash].png'
return 'static/[name].[hash][extname]'
},
chunkFileNames: `static/js/[name].[hash].js`,
entryFileNames: `static/js/[name].[hash].js`,
},
},
},
}
})