Pass in an entire directory into the 'require()' function using Webpack Encore
You can use require.context
for this. Lets say you want to include all img's in the favicon directory, you would do the following.
// Load all favicons in directoryrequire.context('../img/favicon', false, /\.png$|.ico$/);
No need to store the result in a object or use it in your code. Webpack will just include the all the files matching .png and .ico
in your configured output directory.
This way also gives you controll over the files required with the regex at the end.