Menu

#167 fix: apply ESM __dirname shim to src/tools/compose-permissions.ts

closed
nobody
None
2026-04-23
2026-04-21
Anonymous
No

Originally created by: kumaakh

Identified during review of PR [#166].

src/tools/compose-permissions.ts:63 uses bare __dirname outside a try/catch. In dev mode via tsx, this throws ReferenceError: __dirname is not defined if compose_permissions is invoked.

Fix: apply the same ESM shim added to install.ts in [#33]:

import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

Low priority — only affects dev mode. SEA binary is unaffected. Can be batched with next polish sprint.

Related

Tickets: #166
Tickets: #169
Tickets: #33

Discussion

  • Anonymous

    Anonymous - 2026-04-23

    Originally posted by: kumaakh

    Fixed in main: The ESM __dirname shim was applied to src/tools/compose-permissions.ts in PR [#174] (commit 98b348f). The ileURLToPath/dirname shim mirrors the pattern from install.ts so indProfilesDir() works correctly under sx (ESM) without throwing ReferenceError: __dirname is not defined.

     

    Related

    Tickets: #174

  • Anonymous

    Anonymous - 2026-04-23

    Ticket changed by: kumaakh

    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB