There may be use cases where the desired behavior is that the service is restarted only when certain files change, e.g.
void watch({
project: __dirname,
triggers: [
{
expression: [
'anyof',
['match', '*', 'basename'],
],
// Marking this routine as non-interruptible will ensure that
// next dev is not restarted when file changes are detected.
interruptible: false,
name: 'start-server',
onChange: async ({ spawn }) => {
await spawn`next dev`;
},
},
],
});
Setting { interruptible: false } is going to prevent next dev from being restarted. However, what if we want to restart the service when next.config.js changes? Then we could do something like this:
There may be use cases where the desired behavior is that the service is restarted only when certain files change, e.g.
Setting
{ interruptible: false }
is going to preventnext dev
from being restarted. However, what if we want to restart the service whennext.config.js
changes? Then we could do something like this: