From 2c9b8ff7cd6d19020948f9013afaa8c76d8c90e0 Mon Sep 17 00:00:00 2001 From: Venryx Date: Tue, 10 Sep 2024 01:15:54 -0700 Subject: [PATCH] * MS rspack outputs into a separate "DevOutput" folder when running "rspack serve", rather than polluting the "Dist" folder (which should only change when "rspack build" is run). --- Packages/client/.gitignore | 1 + Packages/monitor-client/.gitignore | 1 + Packages/web-vcore/Scripts/RsPack/rspack.js | 5 +++-- Tilt/Main.star | 8 ++++---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Packages/client/.gitignore b/Packages/client/.gitignore index 3856c6d02..e4dcd05fa 100644 --- a/Packages/client/.gitignore +++ b/Packages/client/.gitignore @@ -9,6 +9,7 @@ /.git-rewrite /Source/BakedConfig_Dev.ts /Source/BakedConfig_Prod.ts +/DevOutput /Dist /Source_JS /Tools/Webpack Profiling/Stats.json diff --git a/Packages/monitor-client/.gitignore b/Packages/monitor-client/.gitignore index 44d32d5fd..f8d012828 100644 --- a/Packages/monitor-client/.gitignore +++ b/Packages/monitor-client/.gitignore @@ -2,5 +2,6 @@ **/.DS_Store **/node_modules +/DevOutput /Dist /Source_JS diff --git a/Packages/web-vcore/Scripts/RsPack/rspack.js b/Packages/web-vcore/Scripts/RsPack/rspack.js index a5c9da1c1..805427447 100644 --- a/Packages/web-vcore/Scripts/RsPack/rspack.js +++ b/Packages/web-vcore/Scripts/RsPack/rspack.js @@ -31,7 +31,7 @@ export const buildConfig = options=>{ resourceDirs: [ path.resolve(options.rootDir, "./Resources"), ], - outputDir: path.resolve(options.rootDir, "./Dist"), + outputDir: path.resolve(options.rootDir, RSPACK_IN_DEV_SERVER_MODE() ? "./DevOutput" : "./Dist"), }; /** @type {BuildConfigOptions} */ const opt = { @@ -43,9 +43,10 @@ export const buildConfig = options=>{ require("dotenv").config({path: opt.dotEnvFile}); // read some vars from the environment variables + function RSPACK_IN_DEV_SERVER_MODE() { return process.env.WEBPACK_SERVE == "true"; } // rspack re-uses this env-var name apparently + const QUICK = process.env.QUICK == "true"; const ENV_LONG = process.env.NODE_ENV; const ENV = ENV_LONG === "production" ? "prod" : "dev"; - const QUICK = process.env.QUICK == "true"; const PROD = ENV == "prod"; const DEV = ENV == "dev"; const TEST = false; //ENV == "test"; diff --git a/Tilt/Main.star b/Tilt/Main.star index 5f9469b6d..29be57627 100644 --- a/Tilt/Main.star +++ b/Tilt/Main.star @@ -124,10 +124,10 @@ if PROD: if len(os.getenv("CLIENT_SECRET", "")) < 20: fail("Invalid CLIENT_SECRET env-var value (should be at least 20 chars long): " + os.getenv("CLIENT_SECRET")) -if not os.path.exists("../Packages/client/Dist/app.js"): - fail("File \"./Packages/client/Dist/app.js\" not found. Please build the client first, by running: `npm start client.tsc_noWatch && npm start client.build.prodQuick` (step 1 of readme's \"run-backend-local\" module)") -if not os.path.exists("../Packages/monitor-client/Dist/app.js"): - fail("File \"./Packages/monitor-client/Dist/app.js\" not found. Please build the monitor client first, by running: `npm start monitorClient.tsc_noWatch && npm start monitorClient.build.prodQuick` (step 1 of readme's \"run-backend-local\" module)") +if not os.path.exists("../Packages/client/Dist/index.html"): + fail("File \"./Packages/client/Dist/index.html\" not found. Please build the client first, by running: `npm start client.build.prod` (step 1 of readme's \"run-backend-local\" module)") +if not os.path.exists("../Packages/monitor-client/Dist/index.html"): + fail("File \"./Packages/monitor-client/Dist/index.html\" not found. Please build the monitor client first, by running: `npm start monitorClient.build.prod` (step 1 of readme's \"run-backend-local\" module)") # start specifying resources (to be deployed to k8s soon) # ==========