Skip to content

Commit 2d8b840

Browse files
committed
fix(compass-main): deal with misc module resolution issues
1 parent 9562ae4 commit 2d8b840

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

packages/compass/src/main/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ async function main(): Promise<void> {
8787
trackingProps: { context: 'CLI' },
8888
};
8989

90+
// @ts-expect-error typescript is correctly highlighting that this esm import
91+
// is missing a path, but we're passing this through bundler, so that's kinda
92+
// expected. In theory we should switch tsconfing to moduleResolution: bundler
93+
// to fix this, on practice switching to anything that prefers esm over cjs
94+
// causes a lot of code to stop compiling because types are not being resolved
95+
// correctly, so we're just ignoring this error for now
9096
const { CompassApplication } = await import('./application');
9197

9298
const doImportExport =

packages/compass/src/main/protocol-handling.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import type { PreferencesAccess } from 'compass-preferences-model';
88
const { log, mongoLogId } = createLogger('COMPASS-MAIN');
99

1010
type ProtocolsList = { name: string; schemes: string[] }[];
11+
1112
async function appProtocolsConfig(): Promise<ProtocolsList> {
12-
return (await import('../../package.json')).config.hadron.protocols;
13+
return (await import('../../package.json')).default.config.hadron.protocols;
1314
}
1415

1516
const commandArgv = process.defaultApp

packages/compass/src/main/window-manager.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,13 @@ async function onAppReady() {
220220
'electron-devtools-installer'
221221
);
222222
try {
223+
// @ts-expect-error typescript is right and default export from
224+
// electron-devtools-installer is not a function, but because we're
225+
// passing this code through the bundler it all works fine. In theory we
226+
// should switch tsconfing to moduleResolution: bundler to fix this, on
227+
// practice switching to anything that prefers esm over cjs causes a lot
228+
// of code to stop compiling because types are not being resolved
229+
// correctly, so we're just ignoring this error for now
223230
await installDevtools(REACT_DEVELOPER_TOOLS);
224231
} catch {
225232
// noop

0 commit comments

Comments
 (0)