Skip to content

Commit 92bf2c9

Browse files
committed
Add dev mode constant
1 parent 75e9e24 commit 92bf2c9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/node/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ export const version = pkg.version || "development"
2020
export const commit = pkg.commit || "development"
2121
export const rootPath = path.resolve(__dirname, "../..")
2222
export const tmpdir = path.join(os.tmpdir(), "code-server")
23+
export const isDevMode = commit === "development"

src/node/routes/vscode.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as ipc from "../../../typings/ipc"
77
import { Emitter } from "../../common/emitter"
88
import { HttpCode, HttpError } from "../../common/http"
99
import { getFirstString } from "../../common/util"
10-
import { commit, rootPath, version } from "../constants"
10+
import { isDevMode, rootPath, version } from "../constants"
1111
import { authenticated, ensureAuthenticated, redirect, replaceTemplates } from "../http"
1212
import { getMediaMime, pathToFsPath } from "../util"
1313
import { VscodeProvider } from "../vscode"
@@ -31,7 +31,7 @@ router.get("/", async (req, res) => {
3131
try {
3232
return await vscode.initialize({ args: req.args, remoteAuthority: req.headers.host || "" }, req.query)
3333
} catch (error) {
34-
const devMessage = commit === "development" ? "It might not have finished compiling." : ""
34+
const devMessage = isDevMode ? "It might not have finished compiling." : ""
3535
throw new Error(`VS Code failed to load. ${devMessage} ${error.message}`)
3636
}
3737
})(),
@@ -44,7 +44,7 @@ router.get("/", async (req, res) => {
4444
req,
4545
// Uncomment prod blocks if not in development. TODO: Would this be
4646
// better as a build step? Or maintain two HTML files again?
47-
commit !== "development" ? content.replace(/<!-- PROD_ONLY/g, "").replace(/END_PROD_ONLY -->/g, "") : content,
47+
!isDevMode ? content.replace(/<!-- PROD_ONLY/g, "").replace(/END_PROD_ONLY -->/g, "") : content,
4848
{
4949
authed: req.args.auth !== "none",
5050
disableTelemetry: !!req.args["disable-telemetry"],

0 commit comments

Comments
 (0)