I have a Svelte+Sapper project in which this works just fine:
import logotype from 'images/logo_vertical.svg';
[..]
<img src={logotype} alt="..." />
But is it possible to import an entire folder as such:
import logotypes from 'images/logotypes';
.. and use them like this:
<img src={logotypes.logo1} alt="..." />
or
<img src={logotypes['logo1.svg']} alt="..." />
I have tried importing like this but it does not work since it is then looking for a module rather than a set of images: import logotypes from 'images/logotypes';
'images/logotypes' is imported by ....svelte, but could not be resolved – treating it as an external dependency
And in runtime...
Error: Cannot find module 'images/logotypes'