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

Feature request: cleanup and relaunch #47

Open
bywo opened this issue Jan 24, 2019 · 0 comments · May be fixed by #48
Open

Feature request: cleanup and relaunch #47

bywo opened this issue Jan 24, 2019 · 0 comments · May be fixed by #48

Comments

@bywo
Copy link

bywo commented Jan 24, 2019

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!

@bywo bywo linked a pull request Jan 24, 2019 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant