Skip to content
6 changes: 6 additions & 0 deletions packages/compass/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ async function main(): Promise<void> {
trackingProps: { context: 'CLI' },
};

// @ts-expect-error typescript is correctly highlighting that this esm import
// is missing a path, but we're passing this through bundler, so that's kinda
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// is missing a path, but we're passing this through bundler, so that's kinda
// is missing an extension in the path, but we're passing this through bundler, so that's kinda

// expected. In theory we should switch tsconfing to moduleResolution: bundler
// to fix this, on practice switching to anything that prefers esm over cjs
// causes a lot of code to stop compiling because types are not being resolved
// correctly, so we're just ignoring this error for now
const { CompassApplication } = await import('./application');

const doImportExport =
Expand Down
3 changes: 2 additions & 1 deletion packages/compass/src/main/protocol-handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import type { PreferencesAccess } from 'compass-preferences-model';
const { log, mongoLogId } = createLogger('COMPASS-MAIN');

type ProtocolsList = { name: string; schemes: string[] }[];

async function appProtocolsConfig(): Promise<ProtocolsList> {
return (await import('../../package.json')).config.hadron.protocols;
return (await import('../../package.json')).default.config.hadron.protocols;
}

const commandArgv = process.defaultApp
Expand Down
7 changes: 7 additions & 0 deletions packages/compass/src/main/window-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ async function onAppReady() {
'electron-devtools-installer'
);
try {
// @ts-expect-error typescript is right and default export from
// electron-devtools-installer is not a function, but because we're
// passing this code through the bundler it all works fine. In theory we
// should switch tsconfing to moduleResolution: bundler to fix this, on
// practice switching to anything that prefers esm over cjs causes a lot
// of code to stop compiling because types are not being resolved
// correctly, so we're just ignoring this error for now
await installDevtools(REACT_DEVELOPER_TOOLS);
} catch {
// noop
Expand Down