From cb22d7cb8de0ee04435e21960d323fe3510893ad Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Thu, 4 May 2023 02:13:02 +1000 Subject: [PATCH 01/10] Fix cloud-v2/#416 --- app/ide-desktop/lib/content/watch.ts | 3 +++ .../lib/dashboard/src/authentication/src/config.ts | 2 +- app/ide-desktop/lib/dashboard/watch.ts | 4 ++-- app/ide-desktop/lib/types/globals.d.ts | 3 +++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/ide-desktop/lib/content/watch.ts b/app/ide-desktop/lib/content/watch.ts index 44385f47760a..f14f96be38d1 100644 --- a/app/ide-desktop/lib/content/watch.ts +++ b/app/ide-desktop/lib/content/watch.ts @@ -19,6 +19,9 @@ const HTTP_STATUS_OK = 200 async function watch() { const dashboardOpts = dashboardBundler.bundleOptions() + // Use the development environment. This will make redirects go to the correct URL + // when logging in. + dashboardOpts.define.ENVIRONMENT_OVERRIDE = JSON.stringify('pbuchu') const dashboardBuilder = await esbuild.context(dashboardOpts) // We do not need to serve the dashboard as it outputs to the same directory. // It will not rebuild on request, but it is not intended to rebuild on request anyway. diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts index 3088d550c654..20ef01df5087 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts @@ -16,7 +16,7 @@ const CLOUD_REDIRECTS = { * The redirect URL must be known ahead of time because it is registered with the OAuth provider * when it is created. In the native app, the port is unpredictable, but this is not a problem * because the native app does not use port-based redirects, but deep links. */ - development: newtype.asNewtype('http://localhost:8081'), + development: newtype.asNewtype('http://localhost:8080'), production: newtype.asNewtype('https://cloud.enso.org'), } diff --git a/app/ide-desktop/lib/dashboard/watch.ts b/app/ide-desktop/lib/dashboard/watch.ts index 948e3188b334..c21a1d7ee34b 100644 --- a/app/ide-desktop/lib/dashboard/watch.ts +++ b/app/ide-desktop/lib/dashboard/watch.ts @@ -13,8 +13,8 @@ export const THIS_PATH = path.resolve(path.dirname(url.fileURLToPath(import.meta // === Constants === // ================= -/** This must be port `8081` because it is defined as such in AWS. */ -const PORT = 8081 +/** This must be port `8080` because it is defined as such in AWS. */ +const PORT = 8080 const HTTP_STATUS_OK = 200 // `outputPath` does not have to be a real directory because `write` is `false`, // meaning that files will not be written to the filesystem. diff --git a/app/ide-desktop/lib/types/globals.d.ts b/app/ide-desktop/lib/types/globals.d.ts index 27ca6b15a947..ef7701cd7e16 100644 --- a/app/ide-desktop/lib/types/globals.d.ts +++ b/app/ide-desktop/lib/types/globals.d.ts @@ -63,6 +63,9 @@ declare global { const BUILD_INFO: BuildInfo const PROJECT_MANAGER_IN_BUNDLE_PATH: string const IS_DEV_MODE: boolean + // This variable will be `undefined` if it is unset. + // eslint-disable-next-line no-restricted-syntax + const ENVIRONMENT_OVERRIDE: string | undefined /* eslint-disable @typescript-eslint/naming-convention */ } From 0288d1d7645e8ba2f909ed3e7f82701fc7c3a772 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Thu, 4 May 2023 05:34:05 +1000 Subject: [PATCH 02/10] Fix service worker --- app/ide-desktop/lib/content/src/index.ts | 8 ++++++ .../lib/content/src/serviceWorker.ts | 28 +++++++++++++++++++ app/ide-desktop/lib/content/watch.ts | 9 ++++++ .../lib/dashboard/esbuild-config.ts | 4 +-- app/ide-desktop/lib/dashboard/watch.ts | 4 +-- 5 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 app/ide-desktop/lib/content/src/serviceWorker.ts diff --git a/app/ide-desktop/lib/content/src/index.ts b/app/ide-desktop/lib/content/src/index.ts index 0f71f036b00d..ae15634abfb3 100644 --- a/app/ide-desktop/lib/content/src/index.ts +++ b/app/ide-desktop/lib/content/src/index.ts @@ -20,6 +20,9 @@ const logger = app.log.logger const ESBUILD_PATH = '/esbuild' /** SSE event indicating a build has finished. */ const ESBUILD_EVENT_NAME = 'change' +/** Path to the service worker that resolves all extensionless paths to `/index.html`. + * This service worker is required for client-side routing to work when doing `./run gui watch`. */ +const SERVICE_WORKER_PATH = '/serviceWorker.js' /** One second in milliseconds. */ const SECOND = 1000 /** Time in seconds after which a `fetchTimeout` ends. */ @@ -33,6 +36,11 @@ if (IS_DEV_MODE) { new EventSource(ESBUILD_PATH).addEventListener(ESBUILD_EVENT_NAME, () => { location.reload() }) + try { + void navigator.serviceWorker.register(SERVICE_WORKER_PATH) + } catch { + // Ignored. + } } // ============= diff --git a/app/ide-desktop/lib/content/src/serviceWorker.ts b/app/ide-desktop/lib/content/src/serviceWorker.ts new file mode 100644 index 000000000000..295ca28982ee --- /dev/null +++ b/app/ide-desktop/lib/content/src/serviceWorker.ts @@ -0,0 +1,28 @@ +/** @file A service worker that redirects paths without extensions to `/index.html`. + * This is only used in the cloud frontend. */ +/// + +// ===================== +// === Fetch handler === +// ===================== + +// We `declare` a variable here because Service Workers have a different global scope. +// eslint-disable-next-line no-restricted-syntax +declare const self: ServiceWorkerGlobalScope + +self.addEventListener('fetch', event => { + const url = new URL(event.request.url) + if ( + url.hostname === 'localhost' && + /\/[^.]+$/.test(event.request.url) && + url.pathname !== '/esbuild' + ) { + event.respondWith(fetch('/index.html')) + return + } else { + return false + } +}) + +// Required for TypeScript to consider it a module, instead of in window scope. +export {} diff --git a/app/ide-desktop/lib/content/watch.ts b/app/ide-desktop/lib/content/watch.ts index f14f96be38d1..b710378bec24 100644 --- a/app/ide-desktop/lib/content/watch.ts +++ b/app/ide-desktop/lib/content/watch.ts @@ -1,4 +1,7 @@ /** @file File watch and compile service. */ +import * as path from 'node:path' +import * as url from 'node:url' + import * as esbuild from 'esbuild' import * as portfinder from 'portfinder' import chalk from 'chalk' @@ -10,6 +13,8 @@ import * as dashboardBundler from '../dashboard/esbuild-config' // === Constants === // ================= +/** The path of this file. */ +const THIS_PATH = path.resolve(path.dirname(url.fileURLToPath(import.meta.url))) const PORT = 8080 const HTTP_STATUS_OK = 200 @@ -32,6 +37,10 @@ async function watch() { ...bundler.argumentsFromEnv(), devMode: true, }) + opts.entryPoints.push({ + in: path.resolve(THIS_PATH, 'src', 'serviceWorker.ts'), + out: 'serviceWorker', + }) const builder = await esbuild.context(opts) await builder.watch() await builder.serve({ diff --git a/app/ide-desktop/lib/dashboard/esbuild-config.ts b/app/ide-desktop/lib/dashboard/esbuild-config.ts index 1c5debd6da0a..d799c486d49a 100644 --- a/app/ide-desktop/lib/dashboard/esbuild-config.ts +++ b/app/ide-desktop/lib/dashboard/esbuild-config.ts @@ -103,7 +103,7 @@ function esbuildPluginGenerateTailwind(): esbuild.Plugin { /** Generate the bundler options. */ export function bundlerOptions(args: Arguments) { - const { outputPath } = args + const { outputPath, devMode } = args const buildOptions = { absWorkingDir: THIS_PATH, bundle: true, @@ -121,7 +121,7 @@ export function bundlerOptions(args: Arguments) { define: { // We are defining a constant, so it should be `CONSTANT_CASE`. // eslint-disable-next-line @typescript-eslint/naming-convention - IS_DEV_MODE: JSON.stringify(args.devMode), + IS_DEV_MODE: JSON.stringify(devMode), }, sourcemap: true, minify: true, diff --git a/app/ide-desktop/lib/dashboard/watch.ts b/app/ide-desktop/lib/dashboard/watch.ts index c21a1d7ee34b..09456b5e5b71 100644 --- a/app/ide-desktop/lib/dashboard/watch.ts +++ b/app/ide-desktop/lib/dashboard/watch.ts @@ -7,12 +7,12 @@ import chalk from 'chalk' import * as bundler from './esbuild-config' -export const THIS_PATH = path.resolve(path.dirname(url.fileURLToPath(import.meta.url))) - // ================= // === Constants === // ================= +/** The path of this file. */ +const THIS_PATH = path.resolve(path.dirname(url.fileURLToPath(import.meta.url))) /** This must be port `8080` because it is defined as such in AWS. */ const PORT = 8080 const HTTP_STATUS_OK = 200 From 62907ca4f69480ad3ddfc45825fa837f691b39b5 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Tue, 9 May 2023 02:29:32 +1000 Subject: [PATCH 03/10] Fix URL --- .../lib/dashboard/src/authentication/src/config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts index 20ef01df5087..8e7be3504528 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts @@ -16,8 +16,8 @@ const CLOUD_REDIRECTS = { * The redirect URL must be known ahead of time because it is registered with the OAuth provider * when it is created. In the native app, the port is unpredictable, but this is not a problem * because the native app does not use port-based redirects, but deep links. */ - development: newtype.asNewtype('http://localhost:8080'), - production: newtype.asNewtype('https://cloud.enso.org'), + development: newtype.asNewtype('http://localhost:8081'), + production: newtype.asNewtype('http://localhost:8080'), } /** All possible API URLs, sorted by environment. */ From f3406104fcc1751d795bfe2d1e8fedce62a7b763 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Tue, 9 May 2023 13:37:25 +1000 Subject: [PATCH 04/10] Remove unused define --- app/ide-desktop/lib/content/watch.ts | 3 --- app/ide-desktop/lib/types/globals.d.ts | 3 --- 2 files changed, 6 deletions(-) diff --git a/app/ide-desktop/lib/content/watch.ts b/app/ide-desktop/lib/content/watch.ts index b710378bec24..331ec9df2d7f 100644 --- a/app/ide-desktop/lib/content/watch.ts +++ b/app/ide-desktop/lib/content/watch.ts @@ -24,9 +24,6 @@ const HTTP_STATUS_OK = 200 async function watch() { const dashboardOpts = dashboardBundler.bundleOptions() - // Use the development environment. This will make redirects go to the correct URL - // when logging in. - dashboardOpts.define.ENVIRONMENT_OVERRIDE = JSON.stringify('pbuchu') const dashboardBuilder = await esbuild.context(dashboardOpts) // We do not need to serve the dashboard as it outputs to the same directory. // It will not rebuild on request, but it is not intended to rebuild on request anyway. diff --git a/app/ide-desktop/lib/types/globals.d.ts b/app/ide-desktop/lib/types/globals.d.ts index ef7701cd7e16..27ca6b15a947 100644 --- a/app/ide-desktop/lib/types/globals.d.ts +++ b/app/ide-desktop/lib/types/globals.d.ts @@ -63,9 +63,6 @@ declare global { const BUILD_INFO: BuildInfo const PROJECT_MANAGER_IN_BUNDLE_PATH: string const IS_DEV_MODE: boolean - // This variable will be `undefined` if it is unset. - // eslint-disable-next-line no-restricted-syntax - const ENVIRONMENT_OVERRIDE: string | undefined /* eslint-disable @typescript-eslint/naming-convention */ } From 0f1f1a5297c364edaebdfd43ea2b4e1750f85019 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Tue, 9 May 2023 13:38:29 +1000 Subject: [PATCH 05/10] Fix incorrect port on watcher --- app/ide-desktop/lib/dashboard/watch.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ide-desktop/lib/dashboard/watch.ts b/app/ide-desktop/lib/dashboard/watch.ts index 09456b5e5b71..5d40829fec24 100644 --- a/app/ide-desktop/lib/dashboard/watch.ts +++ b/app/ide-desktop/lib/dashboard/watch.ts @@ -13,8 +13,8 @@ import * as bundler from './esbuild-config' /** The path of this file. */ const THIS_PATH = path.resolve(path.dirname(url.fileURLToPath(import.meta.url))) -/** This must be port `8080` because it is defined as such in AWS. */ -const PORT = 8080 +/** This must be port `8081` because it is defined as such in AWS. */ +const PORT = 8081 const HTTP_STATUS_OK = 200 // `outputPath` does not have to be a real directory because `write` is `false`, // meaning that files will not be written to the filesystem. From 5d607b32acb00719ef9fd2fc9de30459a14f8af2 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Tue, 9 May 2023 23:33:13 +1000 Subject: [PATCH 06/10] Enable authentication and new dashboard by default --- app/ide-desktop/lib/content-config/src/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ide-desktop/lib/content-config/src/config.json b/app/ide-desktop/lib/content-config/src/config.json index 63698f3e085e..f588c3d87f45 100644 --- a/app/ide-desktop/lib/content-config/src/config.json +++ b/app/ide-desktop/lib/content-config/src/config.json @@ -1,7 +1,7 @@ { "options": { "authentication": { - "value": false, + "value": true, "description": "Determines whether user authentication is enabled. This option is always true when executed in the cloud." }, "dataCollection": { @@ -121,7 +121,7 @@ "primary": false }, "newDashboard": { - "value": false, + "value": true, "description": "Determines whether the new dashboard with cloud integration is enabled." }, "profiling": { From 869465a84d922521b88aa3ef477bb4f80f33b84a Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Tue, 9 May 2023 23:38:59 +1000 Subject: [PATCH 07/10] Address review --- app/ide-desktop/lib/content/src/serviceWorker.ts | 3 ++- app/ide-desktop/lib/dashboard/src/authentication/src/config.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/ide-desktop/lib/content/src/serviceWorker.ts b/app/ide-desktop/lib/content/src/serviceWorker.ts index 295ca28982ee..0cf3910c601a 100644 --- a/app/ide-desktop/lib/content/src/serviceWorker.ts +++ b/app/ide-desktop/lib/content/src/serviceWorker.ts @@ -1,4 +1,5 @@ -/** @file A service worker that redirects paths without extensions to `/index.html`. +/** @file A service worker that redirects paths without extensions (e.g. `/login`) to `/index.html`. + * This is required during development, as the `esbuild` server cannot be configured. * This is only used in the cloud frontend. */ /// diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts index 8e7be3504528..10d405e24cea 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts @@ -17,6 +17,8 @@ const CLOUD_REDIRECTS = { * when it is created. In the native app, the port is unpredictable, but this is not a problem * because the native app does not use port-based redirects, but deep links. */ development: newtype.asNewtype('http://localhost:8081'), + // FIXME[sb]: https://github.com/enso-org/cloud-v2/issues/428 + // This URL should switch between `localhost:8080` and `cloud.enso.org` as appropriate. production: newtype.asNewtype('http://localhost:8080'), } From 4794db0a42b838bd9d65081e5d24c5c874cac68f Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Wed, 10 May 2023 17:13:27 +1000 Subject: [PATCH 08/10] Address review --- app/ide-desktop/lib/content/esbuild-config.ts | 5 +++++ app/ide-desktop/lib/content/watch.ts | 1 + app/ide-desktop/lib/dashboard/esbuild-config.ts | 10 ++++++++-- .../lib/dashboard/src/authentication/src/config.ts | 6 +++--- app/ide-desktop/lib/types/globals.d.ts | 3 +++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/ide-desktop/lib/content/esbuild-config.ts b/app/ide-desktop/lib/content/esbuild-config.ts index f53c1002f02e..83af22641783 100644 --- a/app/ide-desktop/lib/content/esbuild-config.ts +++ b/app/ide-desktop/lib/content/esbuild-config.ts @@ -130,7 +130,12 @@ export function bundlerOptions(args: Arguments) { GIT_HASH: JSON.stringify(git('rev-parse HEAD')), GIT_STATUS: JSON.stringify(git('status --short --porcelain')), BUILD_INFO: JSON.stringify(BUILD_INFO), + /** Whether the application is being run locally. This enables a service worker that + * properly serves `/index.html` to client-side routes like `/login`. */ IS_DEV_MODE: JSON.stringify(devMode), + /** Overrides the redirect URL for OAuth logins in the production environment. + * This is needed for logins to work correctly under `./run gui watch`. */ + REDIRECT_OVERRIDE: 'undefined', }, sourcemap: true, minify: true, diff --git a/app/ide-desktop/lib/content/watch.ts b/app/ide-desktop/lib/content/watch.ts index 331ec9df2d7f..8efc916b0894 100644 --- a/app/ide-desktop/lib/content/watch.ts +++ b/app/ide-desktop/lib/content/watch.ts @@ -34,6 +34,7 @@ async function watch() { ...bundler.argumentsFromEnv(), devMode: true, }) + opts.define.REDIRECT_OVERRIDE = JSON.stringify('http://localhost:8080') opts.entryPoints.push({ in: path.resolve(THIS_PATH, 'src', 'serviceWorker.ts'), out: 'serviceWorker', diff --git a/app/ide-desktop/lib/dashboard/esbuild-config.ts b/app/ide-desktop/lib/dashboard/esbuild-config.ts index d799c486d49a..eda5af830718 100644 --- a/app/ide-desktop/lib/dashboard/esbuild-config.ts +++ b/app/ide-desktop/lib/dashboard/esbuild-config.ts @@ -119,9 +119,15 @@ export function bundlerOptions(args: Arguments) { esbuildPluginGenerateTailwind(), ], define: { - // We are defining a constant, so it should be `CONSTANT_CASE`. - // eslint-disable-next-line @typescript-eslint/naming-convention + // We are defining constants, so it should be `CONSTANT_CASE`. + /* eslint-disable @typescript-eslint/naming-convention */ + /** Whether the application is being run locally. This enables a service worker that + * properly serves `/index.html` to client-side routes like `/login`. */ IS_DEV_MODE: JSON.stringify(devMode), + /** Overrides the redirect URL for OAuth logins in the production environment. + * This is needed for logins to work correctly under `./run gui watch`. */ + REDIRECT_OVERRIDE: 'undefined', + /* eslint-enable @typescript-eslint/naming-convention */ }, sourcemap: true, minify: true, diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts index 10d405e24cea..54381a640ccf 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts @@ -17,9 +17,9 @@ const CLOUD_REDIRECTS = { * when it is created. In the native app, the port is unpredictable, but this is not a problem * because the native app does not use port-based redirects, but deep links. */ development: newtype.asNewtype('http://localhost:8081'), - // FIXME[sb]: https://github.com/enso-org/cloud-v2/issues/428 - // This URL should switch between `localhost:8080` and `cloud.enso.org` as appropriate. - production: newtype.asNewtype('http://localhost:8080'), + production: newtype.asNewtype( + REDIRECT_OVERRIDE ?? 'https://cloud.enso.org' + ), } /** All possible API URLs, sorted by environment. */ diff --git a/app/ide-desktop/lib/types/globals.d.ts b/app/ide-desktop/lib/types/globals.d.ts index 27ca6b15a947..4a937908cbb4 100644 --- a/app/ide-desktop/lib/types/globals.d.ts +++ b/app/ide-desktop/lib/types/globals.d.ts @@ -63,6 +63,9 @@ declare global { const BUILD_INFO: BuildInfo const PROJECT_MANAGER_IN_BUNDLE_PATH: string const IS_DEV_MODE: boolean + // This will be `undefined` when it is not defined by esbuild. + // eslint-disable-next-line no-restricted-syntax + const REDIRECT_OVERRIDE: string | undefined /* eslint-disable @typescript-eslint/naming-convention */ } From 29b5ed12f0f35223801d956995335defd415ca13 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Wed, 10 May 2023 19:36:14 +1000 Subject: [PATCH 09/10] Switch `npm run watch-dashboard` to `localhost:8080` --- .../lib/dashboard/src/authentication/src/config.ts | 2 +- app/ide-desktop/lib/dashboard/watch.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts index 54381a640ccf..106a70990645 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/config.ts @@ -16,7 +16,7 @@ const CLOUD_REDIRECTS = { * The redirect URL must be known ahead of time because it is registered with the OAuth provider * when it is created. In the native app, the port is unpredictable, but this is not a problem * because the native app does not use port-based redirects, but deep links. */ - development: newtype.asNewtype('http://localhost:8081'), + development: newtype.asNewtype('http://localhost:8080'), production: newtype.asNewtype( REDIRECT_OVERRIDE ?? 'https://cloud.enso.org' ), diff --git a/app/ide-desktop/lib/dashboard/watch.ts b/app/ide-desktop/lib/dashboard/watch.ts index 5d40829fec24..09456b5e5b71 100644 --- a/app/ide-desktop/lib/dashboard/watch.ts +++ b/app/ide-desktop/lib/dashboard/watch.ts @@ -13,8 +13,8 @@ import * as bundler from './esbuild-config' /** The path of this file. */ const THIS_PATH = path.resolve(path.dirname(url.fileURLToPath(import.meta.url))) -/** This must be port `8081` because it is defined as such in AWS. */ -const PORT = 8081 +/** This must be port `8080` because it is defined as such in AWS. */ +const PORT = 8080 const HTTP_STATUS_OK = 200 // `outputPath` does not have to be a real directory because `write` is `false`, // meaning that files will not be written to the filesystem. From 138158dbe9b637ee35f45fd7962b064fe29922ba Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Fri, 12 May 2023 00:04:33 +1000 Subject: [PATCH 10/10] Fix --- app/ide-desktop/lib/content/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/ide-desktop/lib/content/src/index.ts b/app/ide-desktop/lib/content/src/index.ts index f675d423e7aa..af9bb17ba35a 100644 --- a/app/ide-desktop/lib/content/src/index.ts +++ b/app/ide-desktop/lib/content/src/index.ts @@ -36,6 +36,7 @@ if (IS_DEV_MODE) { new EventSource(ESBUILD_PATH).addEventListener(ESBUILD_EVENT_NAME, () => { location.reload() }) + void navigator.serviceWorker.register(SERVICE_WORKER_PATH) } // =============