Skip to content

Commit

Permalink
chore(compass): work around local dev issue with loading worker from …
Browse files Browse the repository at this point in the history
…a file COMPASS-8504 (#6494)

chore(compass): work around local dev issue with loading worker from a file
  • Loading branch information
gribnoysup authored Nov 14, 2024
1 parent 03e8694 commit 4341cdb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/compass/src/setup-hadron-distribution.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { app } from 'electron';
import { app, protocol, net } from 'electron';

/**
* All these variables below are used by Compass and its plugins in one way or
Expand Down Expand Up @@ -54,6 +54,16 @@ if (
// seemingly nothing is using this path anyway, we probably can ignore an
// error here
app.setPath('userCache', path.join(app.getPath('cache'), app.getName()));

// TODO(COMPASS-8269): even with `webSecurity` disabled for local dev,
// file:// requests for shell worker are silently getting canceled by the
// browser, adding explicit protocol handler for it that just does the same
// request using electron network stack works around the issue
void app.whenReady().then(() => {
protocol.handle('file', (req) => {
return net.fetch(req, { bypassCustomProtocolHandlers: true });
});
});
}

app.setPath(
Expand Down

0 comments on commit 4341cdb

Please sign in to comment.