I recently found myself wanting to run a shell script each time my Webpack build ran, whether or not I was in watch mode.
I was developing two TypeScript packages in a monorepo, with one serving as a dependency of the other. Since the packages were being built in tandem, I wanted to emit TypeScript definitions while actively developing Package A, otherwise type hinting would get confused inside of Package B if I made changes to Package A and didn’t run a full rebuild.
The easiest way to emit definitions from a Typescript library is to use
tsc --emitDeclarationOnly from…