I have a preloader that takes an array of image URLs and starts downloading files immediately after opening my application. Every time I use require () on an image, I would like webpack to add this image URL to the array that my preloader will use.
My first slant is to create a new downloader to merge with the file downloader (which I am currently using for images). The new bootloader will track my images and save them in a JS file as an array, which my preloader will import. But I understand that it probably wonβt work, because the preloader will depend on the file that is created during the build.
My solution to stopping the break is to build the project once, generate an array from the resulting image catalog, copy it back to the preloader and create it again.
I have a feeling that there is a better approach that I ignore, and I am looking for recommendations.
webpack preload
Justin
source share