mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 00:49:17 +09:00
45672a70f9
* fix(frontend): router遷移時にmatchAllに入った場合一度`location.href`を経由するように * Update Changelog * Update CHANGELOG.md * remove unnecessary args
72 lines
1.5 KiB
TypeScript
72 lines
1.5 KiB
TypeScript
import dns from 'dns';
|
|
import { readFile } from 'node:fs/promises';
|
|
import { defineConfig } from 'vite';
|
|
import * as yaml from 'js-yaml';
|
|
import locales from '../../locales/index.js';
|
|
import { getConfig } from './vite.config.js';
|
|
|
|
dns.setDefaultResultOrder('ipv4first');
|
|
|
|
const defaultConfig = getConfig();
|
|
|
|
const { port } = yaml.load(await readFile('../../.config/default.yml', 'utf-8'));
|
|
|
|
const httpUrl = `http://localhost:${port}/`;
|
|
const websocketUrl = `ws://localhost:${port}/`;
|
|
|
|
const devConfig = {
|
|
// 基本の設定は vite.config.js から引き継ぐ
|
|
...defaultConfig,
|
|
root: 'src',
|
|
publicDir: '../assets',
|
|
base: './',
|
|
server: {
|
|
host: 'localhost',
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
changeOrigin: true,
|
|
target: httpUrl,
|
|
},
|
|
'/assets': httpUrl,
|
|
'/static-assets': httpUrl,
|
|
'/client-assets': httpUrl,
|
|
'/files': httpUrl,
|
|
'/twemoji': httpUrl,
|
|
'/fluent-emoji': httpUrl,
|
|
'/sw.js': httpUrl,
|
|
'/streaming': {
|
|
target: websocketUrl,
|
|
ws: true,
|
|
},
|
|
'/favicon.ico': httpUrl,
|
|
'/identicon': {
|
|
target: httpUrl,
|
|
rewrite(path) {
|
|
return path.replace('@localhost:5173', '');
|
|
},
|
|
},
|
|
'/url': httpUrl,
|
|
'/proxy': httpUrl,
|
|
'/_info_card_': httpUrl,
|
|
'/bios': httpUrl,
|
|
'/cli': httpUrl,
|
|
},
|
|
},
|
|
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);
|
|
|