diff options
| author | Kagami Sascha Rosylight <saschanaz@outlook.com> | 2024-01-29 13:39:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-29 21:39:34 +0900 |
| commit | e21cecefa1a395be58918730c07404720220128b (patch) | |
| tree | f2e8d0bb9fb54eff008a91c7f60d2a714fbacf41 | |
| parent | fix(i18n): ストック情報とフロー情報の文言をわかりやすく... (diff) | |
| download | misskey-e21cecefa1a395be58918730c07404720220128b.tar.gz misskey-e21cecefa1a395be58918730c07404720220128b.tar.bz2 misskey-e21cecefa1a395be58918730c07404720220128b.zip | |
test(frontend): load default config to start vite (#12867)
Co-authored-by: おさむのひと <46447427+samunohito@users.noreply.github.com>
| -rw-r--r-- | packages/frontend/vite.config.local-dev.ts | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/packages/frontend/vite.config.local-dev.ts b/packages/frontend/vite.config.local-dev.ts index 5a6f511c66..6d9488797c 100644 --- a/packages/frontend/vite.config.local-dev.ts +++ b/packages/frontend/vite.config.local-dev.ts @@ -1,5 +1,7 @@ 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'; @@ -7,6 +9,11 @@ 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, @@ -19,28 +26,28 @@ const devConfig = { proxy: { '/api': { changeOrigin: true, - target: 'http://localhost:3000/', + target: httpUrl, }, - '/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/', + '/assets': httpUrl, + '/static-assets': httpUrl, + '/client-assets': httpUrl, + '/files': httpUrl, + '/twemoji': httpUrl, + '/fluent-emoji': httpUrl, + '/sw.js': httpUrl, '/streaming': { - target: 'ws://localhost:3000/', + target: websocketUrl, ws: true, }, - '/favicon.ico': 'http://localhost:3000/', + '/favicon.ico': httpUrl, '/identicon': { - target: 'http://localhost:3000/', + target: httpUrl, rewrite(path) { return path.replace('@localhost:5173', ''); }, }, - '/url': 'http://localhost:3000', - '/proxy': 'http://localhost:3000', + '/url': httpUrl, + '/proxy': httpUrl, }, }, build: { |