Skip to content

Instantly share code, notes, and snippets.

@jmkim
Created December 26, 2021 07:19
Show Gist options
  • Save jmkim/ffccfe47dce3392b10ac987e58440a14 to your computer and use it in GitHub Desktop.
Save jmkim/ffccfe47dce3392b10ac987e58440a14 to your computer and use it in GitHub Desktop.
Patch for Coder's code-server 4.0.0 (pre-release) service-worker.js 404 Not Found bug
diff --git a/out/node/routes/index.js b/out/node/routes/index.js
index 55bdaec..e35e526 100644
--- a/out/node/routes/index.js
+++ b/out/node/routes/index.js
@@ -90,6 +90,18 @@ const register = async (app, args) => {
res.set("Content-Type", (0, util_2.getMediaMime)(resourcePath));
return res.send(await fs_1.promises.readFile(resourcePath));
}
+ // Return service-worker.js
+ if (req.originalUrl === "/service-worker.js") {
+ const resourcePath = path.resolve(constants_1.vsRootPath, "out/vs/workbench/contrib/webview/browser/pre/service-worker.js");
+ res.set("Content-Type", (0, util_2.getMediaMime)(resourcePath));
+ return res.send(await fs_1.promises.readFile(resourcePath));
+ }
+ // Return service-worker.js.map
+ if (req.originalUrl === "/service-worker.js.map") {
+ const resourcePath = path.resolve(constants_1.vsRootPath, "out/vs/workbench/contrib/webview/browser/pre/service-worker.js.map");
+ res.set("Content-Type", (0, util_2.getMediaMime)(resourcePath));
+ return res.send(await fs_1.promises.readFile(resourcePath));
+ }
next();
});
app.router.use("/", domainProxy.router);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment