Working on a Webpack loader that needs to transform source for each file and also emit a single file based on data from all those files. Looking at the webpack docs I wasn't quite sure if a loader can / should handle something like this or if a webpack plugin would be better suited for my use case.
I see this.emitFile
in the api docs for webpack loaders so I was thinking that I could collect data from each file in the this.data
object during the pitch phase of the loader and emitFile on the final pitch. This feels like kind of a hack tho.
Is there a better way to do this with webpack loaders or should I be creating a webpack plugin instead?