I am using React for a period of time and absolutely love the file watch functionality provided by webpack loaders. I have written some simple loaders for my needs also, but now I have a bit complex task to solve.
Well, there are some binary files in the project that I am loading into React using a custom webpack loader and also it generates some intermediate data (image preview) that I want to save to the file in order to use with 3rd-party tools (for example, image editor). I'd like to have this preview image regenerated each time when the source file(s) is changed - webpack loader can handle this with the file watch option, that is great!
But my question is: whether it is a correct task for webpack? Or maybe I should use another js-based tool? May I organize the webpack loading chain this way so files, generated by one loader and SAVED/UPDATED to disk will be immediately loaded by another webpack loader?
I can't found any examples for this in the NET so if you know how to do that please give me an idea.
Thanks!
P.S. So the react app should look like this
FILESET1 -> webpack-loader1 -> PREVIEW_IMAGE_TO_DISK -> result is accessible as js object in react
PREVIEW_IMAGE_FROM_DISK -> webpack-loader2 -> result accessible as js object in react
I know about webpack loader chaining ability, but it's all about js objects in memory. I need file processing because 'webpack-loader2' is working with files, not js objects.
pff.. Hope this is clear.