Skip to content

Feature request: cleanup and relaunch #47

@bywo

Description

@bywo

Hi there, thanks for maintaining this awesome tool. It's a great way to reduce recompile times.

I'm trying to do something a little out of the ordinary. I'd like to have my dev server and my tests share the same in-memory ts-node compiler so I can quickly switch between running tests and playing with my dev server while making changes to my source files.

I'd also like to reuse ts-node-dev because you've already solved the main problem of hooking into require for transpilation and file watching. I believe I can achieve this by making it possible for ts-node-dev clean up after itself via a programmatic API.

What I mean is this:

const start = require("ts-node-dev/lib/index.js")
let dispose = start("my-server.ts");
...
dispose(); // filewatcher and child process get killed, but ts-node compiler sticks around
dispose = start("my-tests.ts"); // second `start()` call doesn't re-init compiler
...
dispose(); 

What do you think? If you're okay with this functionality, I can open a PR. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions