What is the best practice for adding subtasks to serve-task?



My goal is to generate a file inside assets-directory during ionic serve-task’s operations. My current solution is that I have the following block in my package.json:

"config": {
    "ionic_webpack": "./webpack_config.js"

My custom webpack_config.js is based on the original file from ionic-app-scripts/config/webpack.config.js. Sort of like below:

(function () {

    var customAssetsFileGenerator = require('./custom_operation.js');

    // REGULAR web pack.config.js contents pasted here...

UPDATE: It didn’t work, after all. My injection is run only on ionic serve starting up. It is not run during the watch-triggered build update phase, which I intended.

My question is: What is the ‘proper’ way to do it?