New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: vite-node + HMR 적용 #591
Conversation
8c1f1d7
to
c44d06b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -29,6 +29,7 @@ services: | |||
container_name: backend | |||
build: | |||
context: . | |||
entrypoint: ["./node_modules/.bin/vite-node", "src/server.ts"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entrypoint 를 Dockerfile 이 아닌 docker-compose 파일에서 실행해야 하나요?
궁금해서 질문드립니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
도커파일에 ENTRYPOINT
를 사용해도 문제는 없습니다.
Lines 18 to 24 in e9fac6d
FROM workspace as prod | |
ADD . ./ | |
RUN pnpm -r install --frozen-lockfile --offline | |
RUN pnpm -r run build | |
WORKDIR /app/backend |
다만 도커파일에서는 ENTRYPOINT
의 값이 변할 때마다 마지막 단계 캐싱이 무효화되어 해당 단계를 다시 빌드해야 하는 문제가 있었습니다. 이를 해결하기 위해 포트나 환경 변수 파일처럼, 컴포즈 파일에서 엔트리포인트를 관리하도록 변경했습니다.
"start": "npx vite-node src/server.ts", | ||
"build": "pnpm --filter='@jiphyeonjeon-42/contracts' build", | ||
"dev": "nodemon --watch src --watch ../contracts/dist --exec ts-node src/server.ts", | ||
"prod": "pnpm build && pnpm start", | ||
"dev": "vite-node --watch src/server.ts", | ||
"standalone": "npm run build && npm run start", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
변경된 명령어에 대해 어딘가 설명을 남겨주시면 감사드리겠습니다.
주석이나 README 혹은 docs 면 좋을 것 같습니다.
* build: vite 추가 * build: vite + esm 모듈로 전환 * build: nodemon, ts-node 제거 * fix: entities를 named export로 변경 * perf: hmr 적용 --------- Co-authored-by: nocontribute <>
개요
2023-07-19.14-09-54.mp4
backend/
코드 뿐만 아니라 모노레포의contracts/
패키지가 수정되어도 적용되는 것을 볼 수 있습니다. (contracts/에서 pnpm dev로 먼저 패키지를 실시간으로 빌드하도록 해야 합니다)변경점
pnpm dev
로 실행 가능합니다기타