🥹😍 Không hiểu tại sao khi sử dụng nodemon.json nó mới chạy được?

Nhận thấy khi thêm cấu hình --file nó mới chạy

package.json

{
  "scripts": {
    "dev": "ts-node --files ./src/index.ts"
  },
  "dependencies": {
    "@types/node": "^22.13.4",
    "@types/typescript": "^2.0.0",
    "nodemon": "^3.1.9",
    "ts-node": "^10.9.2",
    "typescript": "^5.7.3"
  }
}

Còn không bạn phải cấu hình file nodemon.json như sau

{
  "watch": ["src"],
  "ext": ".ts,.js",
  "ignore": [],
  "exec": "ts-node --files ./src/index.ts"
}

package.json

src\index.ts

src\types\index.d.ts

file-archive
9KB
archive

Hoặc

src\index.ts

Hoặc ta có thể ném index.d.ts ra khỏi thư mục nó vẫn hoạt động ok

file-archive
8KB
archive

Nếu ném nó vào thư mục src nó báo lỗi

Nhận thấy khi đổi tên thành abc.d.ts nó vân hoạt động tốt ở ngoài lẫn ở trong types hoặc thư mục test cũng ok

Last updated