Created
June 7, 2021 19:00
-
-
Save AubreyF/00462643d8c75128642d2221b2393bab to your computer and use it in GitHub Desktop.
Incorporate all images from folder into webpack build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Incorporate dynamically-referenced product and interface reference images into the build | |
export const resourceRefs = require.context( | |
'./resources', | |
false, | |
/\.(png|jpe?g)$/, | |
); | |
export const ImageResource = {}; | |
// eslint-disable-next-line no-return-assign | |
resourceRefs | |
.keys() | |
.map((item) => (ImageResource[item.replace('./', '')] = resourceRefs(item))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment