I am trying to execute two different scripts using nodemon when it starts and when it restarts. The issue is that nodemon calls both start and restart events whenever it detects a change in a file.
So how can I execute two different scripts on start and restart. My purpose of doing so is because whenever nodemon picks up any change in a file, it restarts the webpack-dev-server and a new tab is opened in the browser instead of reusing the existing tab.
package.json
"start": "nodemon --watch app.js",
nodemon.json
{
"events": {
"start": "webpack-dev-server --config=webpack.dev.config.js --open",
"restart": "webpack-dev-server --config=webpack.dev.config.js"
}
}
webpack.dev.config.js
.
.
devServer: {
contentBase: "src",
compress: true,
stats: "minimal",
}