Skip to content

fix(build): point tsc-alias at tsconfig.build.json - #218

Merged
aquie00t merged 1 commit into
mainfrom
fix/tsc-alias-build-config
Aug 26, 2026
Merged

fix(build): point tsc-alias at tsconfig.build.json#218
aquie00t merged 1 commit into
mainfrom
fix/tsc-alias-build-config

Conversation

@aquie00t

Copy link
Copy Markdown
Collaborator

Problem

pnpm run build succeeded but pnpm run start crashed immediately:

Error: Cannot find module '@plugins/env.plugin'
Require stack:
- dist/app.js
- dist/index.js

Cause

The build script ran tsc-alias with no -p, so it fell back to tsconfig.json instead of tsconfig.build.json. That config has rootDir: "./" and also includes tests/ and scripts/, so tsc-alias expected the emitted files under dist/src/** and matched nothing — a silent no-op (0 files affected). Meanwhile tsc -p tsconfig.build.json emits to dist/** with rootDir: "./src".

The compiled output therefore kept the raw path aliases:

const env_plugin_1 = __importDefault(require("@plugins/env.plugin"));

Node cannot resolve those, hence MODULE_NOT_FOUND. pnpm dev was unaffected because tsx resolves the aliases at runtime.

Fix

-"build": "tsc -p tsconfig.build.json && tsc-alias"
+"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json"

Verification

rm -rf dist && pnpm run build — tsc-alias now reports 119 files were affected! and the output is rewritten to relative paths:

const env_plugin_1 = __importDefault(require("./http/plugins/env.plugin"));

pnpm run start boots cleanly: the three purge schedulers initialize, the server listens on port 3000, and the Redis publisher/subscriber connect.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GgfZaJS1UU5VVfmMeL2CRT

Without -p, tsc-alias falls back to tsconfig.json, whose rootDir is "./"
(it also includes tests/ and scripts/). It therefore looked for emitted
files under dist/src/** and matched nothing, while tsc -p
tsconfig.build.json emits to dist/** with rootDir ./src.

The result was a silent no-op: dist/app.js kept raw aliases such as
require("@plugins/env.plugin"), so pnpm start crashed with
MODULE_NOT_FOUND. pnpm dev was unaffected because tsx resolves the
aliases at runtime.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgfZaJS1UU5VVfmMeL2CRT
@aquie00t
aquie00t merged commit 3c11315 into main Aug 26, 2026
10 checks passed
@aquie00t
aquie00t deleted the fix/tsc-alias-build-config branch August 26, 2026 05:08
github-actions Bot pushed a commit that referenced this pull request Aug 26, 2026
## [1.7.2](v1.7.1...v1.7.2) (2026-08-26)

### Bug Fixes

* **build:** point tsc-alias at tsconfig.build.json ([#218](#218)) ([3c11315](3c11315))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.7.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant