kmagiera / babel-watch

Reload your babel-node app on JS source file changes. And do it fast.
MIT License
529 stars 70 forks source link

JavaScript API? #129

Open coolov opened 3 years ago

coolov commented 3 years ago

Hey!

Thanks for an excellent tool!

Has there been any interest in creating a module api so that the tool can be more easily integrated into other toolchains, e.g.:

import babelWatch from 'babel-watch';

const watcher = babelWatch(src, { extensions: ['.js', '.ts'] };

// maybe some custom event api, that lets you access the build lifecycle
// e.g. watcher.on('restart')

// maybe some way to manually restart the build, e.g.
// watcher.restart();

Is this something that you think fits in the scope of this tool? And if you do, is it something that you need help with?

Similar APIs: https://vitejs.dev/guide/api-javascript.html https://webpack.js.org/configuration/dev-server/ https://www.snowpack.dev/reference/javascript-interface

STRML commented 3 years ago

I think that's a great idea! That would be a good way to help testability. I could use help on it.