During my build, I need to download files over HTTP, process them, and finally save them as part of the resulting bundle (I'm not writing a reusable plugin, so saving to hardcoded paths that I know to be the build's output location is fine).
Currently I'm doing it before exporting the config:
fetchFilesFromInternetAndProcessThem().then(
() => console.info("Successfully fetched, processed & included external files in the build."),
e => console.error("Failed to include external files in the build.", e)
);
module.exports = {
target: "node",
stats: "minimal",
...
However, if the promise fails, the build will obviously still succeed... which is bad because those files are required for the successful running of my application.
Is there a plugin I can use (or other solution) that allows arbitrary asynchronous code execution before/after a build, and will fail the build if said asynchronous code fails?