Skip to content

fix(build): resolver path aliases @/ no JavaScript compilado#17

Merged
diego64 merged 1 commit into
mainfrom
fix/path-aliases-build
Jun 7, 2026
Merged

fix(build): resolver path aliases @/ no JavaScript compilado#17
diego64 merged 1 commit into
mainfrom
fix/path-aliases-build

Conversation

@diego64

@diego64 diego64 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add tsc-alias to the build script (tsc && tsc-alias) to rewrite @/ path aliases to relative paths after TypeScript compilation
  • Without this, node dist/... fails immediately with ERR_MODULE_NOT_FOUND: Cannot find package '@/infra' because Node.js ESM resolver treats @/ as a scoped package name
  • Add docker-build job to ci.yml to validate the Dockerfile builds correctly on every PR (no push, just compile check)
  • Restructure release.yml: manual approval (environment: producao) now gates the Docker Hub push — the image is only published after an authorized reviewer approves, then Render pulls the new latest tag automatically

Root cause

tsc with paths aliases resolves them at type-check time but emits the original @/ strings unchanged into the compiled .js files. The Node.js runtime has no knowledge of these aliases and interprets @/infra as a scoped npm package — which doesn't exist, causing a crash at startup.

Test plan

  • pnpm build — confirm dist/ contains relative imports (../../infra/...) with no @/ remaining
  • pnpm lint && pnpm typecheck && pnpm test — all passing (359 tests)
  • Push to Render — server should start without ERR_MODULE_NOT_FOUND
  • Push a v*.*.* tag — confirm the release pipeline pauses at aprovacao-producao before any image is pushed to Docker Hub

🤖 Generated with Claude Code

Adiciona tsc-alias ao script de build para reescrever os aliases
@/* para caminhos relativos apos a compilacao do TypeScript.
Sem isso, o Node.js falha ao tentar resolver @/ como pacote npm
(ERR_MODULE_NOT_FOUND) em ambientes cloud como Render.

Adiciona validacao do Dockerfile no CI (docker-build) e reestrutura
o release para push ao Docker Hub ocorrer apenas apos aprovacao manual.
@diego64 diego64 merged commit 36d28b0 into main Jun 7, 2026
@diego64 diego64 deleted the fix/path-aliases-build branch June 7, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant