I have a problem that makes no sense to me.
I map an array of objects having the property "name" and "href".
let appleIcons = _.map(appleIcons, appleIcon => { appleIcon.href = require(appleIcon.href); return appleIcon; });
Inside the loop, I want to request an image, but it throws an error ". * $: 11 Unused error: cannot find the module."
When I print the value of appleIcon.href and I try to put it directly in require (''), it works.
appleIcons = _.map(appleIcons, appleIcon => { appleIcon.href = require('./../../mobile-config/apple-icon-57x57.png'); return appleIcon; });
So can you explain to me why the second example works, and the first causes an error? How to put a variable inside require ('')?
Thanks!
javascript webpack
Kitze
source share