Skip to content
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

[DX] Improve Development Server File Watching #18

Open
mislam opened this issue Feb 9, 2025 · 0 comments
Open

[DX] Improve Development Server File Watching #18

mislam opened this issue Feb 9, 2025 · 0 comments

Comments

@mislam
Copy link
Owner

mislam commented Feb 9, 2025

Current Behavior:

  • Server doesn't reload when .env file changes
  • New files added to src directory don't trigger reload
  • Only existing TypeScript files are watched

Expected Behavior:

  • Server should restart when any relevant file changes:
    • .env file modifications
    • New TypeScript files added to src
    • Changes in imported modules

Proposed Solutions:

  1. Option A: Use Nodemon

    npm install nodemon --save-dev

    Update dev script:

    "dev": "nodemon --watch src --watch .env src/index.ts -x 'tsx'"

    Pros: Industry standard, reliable watching
    Cons: Adds dependency

  2. Option B: Enhance TSX Watch

    "dev": "tsx watch --watch-path src --watch-path .env src/index.ts"

    Pros: No new dependencies
    Cons: Less mature watching implementation

Technical Notes:

  • Both solutions require testing edge cases:
    • Adding new files to watched directories
    • Changing environment variables
    • Modifying imported modules
  • Consider long-term maintenance and DX
@mislam mislam changed the title Improve Development Server File Watching [DX] Improve Development Server File Watching Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant