summaryrefslogtreecommitdiff
path: root/packages/frontend/vite.config.local-dev.ts
blob: aea46f423123c46f5cfccb318c8a9a529306d2e2 (plain)
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
import dns from 'dns';
import { defineConfig } from 'vite';
import locales from '../../locales';
import { getConfig } from './vite.config.js';

dns.setDefaultResultOrder('ipv4first');

const defaultConfig = getConfig();

const devConfig = {
	// 基本の設定は vite.config.js から引き継ぐ
	...defaultConfig,
	root: 'src',
	publicDir: '../assets',
	base: './',
	server: {
		host: 'localhost',
		port: 5173,
		proxy: {
			'/api': {
				changeOrigin: true,
				target: 'http://localhost:3000/',
			},
			'/assets': 'http://localhost:3000/',
			'/static-assets': 'http://localhost:3000/',
			'/client-assets': 'http://localhost:3000/',
			'/files': 'http://localhost:3000/',
			'/twemoji': 'http://localhost:3000/',
			'/fluent-emoji': 'http://localhost:3000/',
			'/sw.js': 'http://localhost:3000/',
			'/streaming': {
				target: 'ws://localhost:3000/',
				ws: true,
			},
			'/favicon.ico': 'http://localhost:3000/',
			'/identicon': {
				target: 'http://localhost:3000/',
				rewrite(path) {
					return path.replace('@localhost:5173', '');
				},
			},
			'/url': 'http://localhost:3000',
			'/proxy': 'http://localhost:3000',
		},
	},
	build: {
		...defaultConfig.build,
		rollupOptions: {
			...defaultConfig.build?.rollupOptions,
			input: 'index.html',
		},
	},

	define: {
		...defaultConfig.define,
		_LANGS_FULL_: JSON.stringify(Object.entries(locales)),
	},
};

export default defineConfig(({ command, mode }) => devConfig);