Skip to content

Commit

Permalink
* MS rspack outputs into a separate "DevOutput" folder when running "…
Browse files Browse the repository at this point in the history
…rspack serve", rather than polluting the "Dist" folder (which should only change when "rspack build" is run).
  • Loading branch information
Venryx committed Sep 10, 2024
1 parent 7e9329c commit 2c9b8ff
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions Packages/client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/.git-rewrite
/Source/BakedConfig_Dev.ts
/Source/BakedConfig_Prod.ts
/DevOutput
/Dist
/Source_JS
/Tools/Webpack Profiling/Stats.json
Expand Down
1 change: 1 addition & 0 deletions Packages/monitor-client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
**/.DS_Store
**/node_modules

/DevOutput
/Dist
/Source_JS
5 changes: 3 additions & 2 deletions Packages/web-vcore/Scripts/RsPack/rspack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions Tilt/Main.star
Original file line number Diff line number Diff line change
Expand Up @@ -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)
# ==========
Expand Down

0 comments on commit 2c9b8ff

Please sign in to comment.