fix(build): resolver path aliases @/ no JavaScript compilado#17
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tsc-aliasto thebuildscript (tsc && tsc-alias) to rewrite@/path aliases to relative paths after TypeScript compilationnode dist/...fails immediately withERR_MODULE_NOT_FOUND: Cannot find package '@/infra'because Node.js ESM resolver treats@/as a scoped package namedocker-buildjob toci.ymlto validate the Dockerfile builds correctly on every PR (no push, just compile check)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 newlatesttag automaticallyRoot cause
tscwithpathsaliases resolves them at type-check time but emits the original@/strings unchanged into the compiled.jsfiles. The Node.js runtime has no knowledge of these aliases and interprets@/infraas a scoped npm package — which doesn't exist, causing a crash at startup.Test plan
pnpm build— confirmdist/contains relative imports (../../infra/...) with no@/remainingpnpm lint && pnpm typecheck && pnpm test— all passing (359 tests)ERR_MODULE_NOT_FOUNDv*.*.*tag — confirm the release pipeline pauses ataprovacao-producaobefore any image is pushed to Docker Hub🤖 Generated with Claude Code