-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
How to configure rollup watcher handlers? #2117
Comments
Hey hey :) Currently there isnt much API for this stuff. Best option propably is: https://rollupjs.org/guide/en#rollup-watch I created a notifier in one of my projects too using the rollup.watch and a websocket. That combination worked pretty okay-ish :D. (P.S. My solution isnt yet on github) |
Are you saying that having these types of events on the plugin interface would be useful to what you're building here? This might be a direction we could consider. |
I guess a minimal but flexible approach would be to have an onwatch option in the plugin config which only is called at rollup.watch and gets the watcher as parameter. Something like" var notPomodoroTimeConsideringRollupNotificationPlugin = function(pomodoroTimesToIgnore) {
var fayeClient ....
return {
name: 'nPTCRNP',
onwatch: (watcher) {
watcher.on('event', () => {
fayeClient.publish('/rollupMessages', {
action: 'shutdownBrowserHost'
}
}
}
}
} Or something like that I guess. |
I think this could possibly be handled in plugins / config via a |
Any changes? How to get watch instance in buildStart? |
@zerkalica so you want access to watch events from a plugin? Perhaps we can just pass the watcher as an optional argument to buildStart then? Let me know if that sounds sensible. |
Yes, argument in buildStart sounds good. |
@zerkalica sure, I've created #2261, let me know if that seems useful here. |
I am just leaving that here because one comes here when searching for "rollup notify"... This outputs a "bell" character which most terminal emulators turn into a desktop notification: # rollup.config.ts
export default {
...
plugins: [
new class implements OutputPlugin {
name = 'bell';
buildEnd(error?: Error) {
// Jonas needs his "bell" for "watch"able build scripts
console.log(String.fromCharCode(7))
}
},
...
]
} |
I try to create rollup-plugin-notifier, like webpack-notifier. But i can't find any api to passing custom handler to watcher instance from rollup plugin or config.
May be add some api to plugins?
The text was updated successfully, but these errors were encountered: