1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-27 14:28:49 +09:00

build: port vite port configuration (#12223)

This commit is contained in:
anatawa12 2023-11-03 13:34:57 +09:00 committed by GitHub
parent 0efacdfcf0
commit 3e00b32fae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -253,8 +253,9 @@ export class ClientServerService {
decorateReply: false,
});
} else {
const port = (process.env.VITE_PORT ?? '5173');
fastify.register(fastifyProxy, {
upstream: 'http://localhost:5173', // TODO: port configuration
upstream: 'http://localhost:' + port,
prefix: '/vite',
rewritePrefix: '/vite',
});

View File

@ -11,6 +11,8 @@ import { execa } from 'execa';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
const vitePort = process.env.VITE_PORT ? ["--strictPort", "--port", process.env.VITE_PORT] : ["--strictPort"];
await execa('pnpm', ['clean'], {
cwd: _dirname + '/../',
stdout: process.stdout,
@ -41,7 +43,7 @@ execa('pnpm', ['--filter', 'backend', 'watch'], {
stderr: process.stderr,
});
execa('pnpm', ['--filter', 'frontend', 'watch'], {
execa('pnpm', ['--filter', 'frontend', 'watch', ...vitePort], {
cwd: _dirname + '/../',
stdout: process.stdout,
stderr: process.stderr,