Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.
This repository was archived by the owner on May 8, 2026. It is now read-only.

Fix ESM import resolution: enable rewriteRelativeImportExtensions in tsconfig.json #7

@rowan-stein

Description

@rowan-stein

Problem

The docker-runner container crashes at startup with ERR_MODULE_NOT_FOUND when deployed using the standalone image (node dist/service/main.js).

Root cause: package.json declares "type": "module" (ESM), and TypeScript source files use extensionless relative imports (e.g., import './config'). The tsc compiler does not rewrite import specifiers, so the compiled JS files contain import './config' instead of import './config.js'. Node.js ESM requires explicit .js extensions and crashes immediately.

The old platform monorepo worked because it used tsx (a TypeScript runtime that handles resolution transparently) instead of node dist/....

Fix

Add "rewriteRelativeImportExtensions": true to tsconfig.json compilerOptions. This is a TypeScript 5.7+ feature that rewrites ./foo./foo.js in the compiled output. The repo already uses TypeScript ^5.8.3.

Verification

After the fix:

pnpm build
head -5 dist/service/main.js
# Should show: import './env.js'; import { loadRunnerConfig } from './config.js'; etc.

Also verify pnpm lint, pnpm build, and pnpm test still pass.

Context

Discovered during bootstrap CI (agynio/bootstrap_v2 PR #97) — docker-runner pod enters CrashLoopBackOff when deployed with chart 0.1.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions