tettusud / merge-jsons-webpack-plugin

This plugin is used to merge json files into single json file,using glob or file names
https://npmjs.com/package/merge-jsons-webpack-plugin
Apache License 2.0
36 stars 20 forks source link

Fixed error thrown when no files to merge were found. #69

Open zagushka opened 3 years ago

zagushka commented 3 years ago

Fixed error thrown when no files to merge were found. I been stuck with such error when created groupBy rule with a pattern having no matching files. Now instead of throwing

(node:67426) UnhandledPromiseRejectionWarning: TypeError: Reduce of empty array with no initial value at Array.reduce ()

It will create a blank output file, with empty json {} In general, just added initial value to .reduce

tech-meppem commented 2 years ago

Just to say we also encountered this problem. When no files are found, it throws an error (same one as above).

Maybe an option for "when no files found" could be passed in, to default to that when nothing is found? Instead of erroring?