Closed artalar closed 2 years ago
No, not sure how that makes any sense for the usage. mind sharing an example? tsm is basically a node
replacement or used within existing programs as a transformer
No, not sure how that makes any sense for the usage. mind sharing an example? tsm is basically a
node
replacement or used within existing programs as a transformer
As a replace of nodemon
or ts-node-dev
We implement watch mode like this. The use case is restarting server on any change. Very handy.
import { spawn } from 'child_process';
import { watch } from 'watchlist';
let childProcess = null;
const startServer = () => {
if (childProcess) {
childProcess.kill();
}
console.info('Starting/Restarting dev server');
childProcess = spawn('node', ['--loader=tsm', 'src/docs.ts'], {
stdio: 'inherit',
env: process.env,
});
};
watch(['.'], startServer, { eager: true });
You can use nodemon with config files that use tsm. https://github.com/remy/nodemon#config-files
Any plans for watch mode?