From 4f80b6fa5d1195c8372a14c6e32b0e7a8287b906 Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 13 Feb 2024 00:54:34 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BB=A5=E5=89=8D=E3=81=AE=E9=96=8B?= =?UTF-8?q?=E7=99=BA=E7=92=B0=E5=A2=83=EF=BC=88backend=E3=81=AB=E3=82=A2?= =?UTF-8?q?=E3=82=AF=E3=82=BB=E3=82=B9=E3=81=99=E3=82=8B=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=EF=BC=89=E3=82=92=E7=AB=8B=E3=81=A1=E4=B8=8A=E3=81=92=E3=82=89?= =?UTF-8?q?=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20(#13220)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 以前の開発環境(backendにアクセスする方式)を立ち上げられるように * Update scripts/dev.mjs Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> --------- Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> --- CONTRIBUTING.md | 13 +++++++++++++ scripts/dev.mjs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ac0a1ba3c..a3263bf6a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -122,6 +122,19 @@ command. If you have not changed it from the default, it will be "http://localhost:3000". If "port" in .config/default.yml is set to something other than 3000, you need to change the proxy settings in packages/frontend/vite.config.local-dev.ts. +### `MK_DEV_PREFER=backend pnpm dev` +pnpm dev has another mode with `MK_DEV_PREFER=backend`. + +``` +MK_DEV_PREFER=backend pnpm dev +``` + +- This mode is closer to the production environment than the default mode. +- Vite runs behind the backend (the backend will proxy Vite at /vite). +- You can see Misskey by accessing `http://localhost:3000` (Replace `3000` with the port configured with `port` in .config/default.yml). +- To change the port of Vite, specify with `VITE_PORT` environment variable. +- HMR may not work in some environments such as Windows. + ### Dev Container Instead of running `pnpm` locally, you can use Dev Container to set up your development environment. To use Dev Container, open the project directory on VSCode with Dev Containers installed. diff --git a/scripts/dev.mjs b/scripts/dev.mjs index e882ae6b0..4ca46a260 100644 --- a/scripts/dev.mjs +++ b/scripts/dev.mjs @@ -64,7 +64,7 @@ execa('pnpm', ['--filter', 'backend', 'dev'], { stderr: process.stderr, }); -execa('pnpm', ['--filter', 'frontend', 'dev'], { +execa('pnpm', ['--filter', 'frontend', process.env.MK_DEV_PREFER === 'backend' ? 'dev' : 'watch'], { cwd: _dirname + '/../', stdout: process.stdout, stderr: process.stderr,