2023-06-19 15:20:17 +09:00
|
|
|
# TypeScript で書いたサーバーをワンライナーで構築してみよう
|
|
|
|
|
2023-12-19 14:05:09 +09:00
|
|
|
tsx
|
2023-06-19 15:20:17 +09:00
|
|
|
|
|
|
|
```
|
2023-12-19 14:05:09 +09:00
|
|
|
npx tsx main.ts
|
2023-06-19 15:20:17 +09:00
|
|
|
```
|
|
|
|
|
2023-12-19 14:05:09 +09:00
|
|
|
tsx + watch
|
2023-06-19 15:20:17 +09:00
|
|
|
|
|
|
|
```
|
2023-12-19 14:05:09 +09:00
|
|
|
npx tsx --watch main.ts
|
2023-06-19 15:20:17 +09:00
|
|
|
```
|
|
|
|
|
2023-12-19 14:05:09 +09:00
|
|
|
esbuild (esbuild-register)
|
2023-06-19 15:20:17 +09:00
|
|
|
|
|
|
|
```
|
2023-12-19 14:05:09 +09:00
|
|
|
node -r esbuild-register main.ts
|
2023-06-19 15:20:17 +09:00
|
|
|
```
|
|
|
|
|
2023-12-19 14:05:09 +09:00
|
|
|
esbuild (esbuild-register) + watch
|
2023-06-19 15:20:17 +09:00
|
|
|
|
2023-12-19 14:05:09 +09:00
|
|
|
```
|
|
|
|
node -r esbuild-register --watch main.ts
|
|
|
|
```
|
2023-06-19 15:20:17 +09:00
|
|
|
|
2023-12-19 14:05:09 +09:00
|
|
|
tsup
|
2023-06-19 15:20:17 +09:00
|
|
|
|
|
|
|
```
|
2023-12-19 14:05:09 +09:00
|
|
|
npx tsup main.ts --clean --onSuccess 'node dist/main.js'
|
2023-06-19 15:20:17 +09:00
|
|
|
```
|
|
|
|
|
2023-12-19 14:05:09 +09:00
|
|
|
tsup + watch
|
2023-06-19 15:20:17 +09:00
|
|
|
|
2023-12-19 14:05:09 +09:00
|
|
|
```
|
|
|
|
npx tsup main.ts --clean --watch --onSuccess 'node dist/main.js'
|
|
|
|
```
|