[느린게 싫다면-02] esbuild 로 typescript 서버 실행

2021. 10. 10. 00:45개발/TypeScript

Typescript로 프로젝트를 만들면 tsc 속도가 마음에 들지 않고, esbuild 가 속도가 워낙 좋다보니
etcs 라는 패키지를 발견해서 적용해봤다.

 

 

프로젝트 주요 적용 사항

  • eslint
  • prettier
  • babel
  • nodemon
  • path alias

 

속도는 우선 너무 만족 스러웠다.

 

1. 기본 javascript 모듈만 사용후 싱글 파일로만 실행

import http from 'http';

const PORT = process.env.PORT || 3000;

const server = http.createServer((req, res) => {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('Hello World');
});

server.listen(PORT, () => {
  console.log(`Server running at http://localhost:${PORT}`);
});
M1 기준

빌드 속도가 50~60ms

2. express + path alias

빌드 속도 55ms ~ 90ms

 

GitHub link : https://github.com/shingidad/starterkit-typescript-esbuild