Webpack require.context Pre-load Dynamic Assets -


i'm using webpack create collection of games. pre-load assets (.svg files) based on run time configuration. i'm trying this:

let requestgameassets = require["context"]('../../../resources/html5images/gameassets', true, /.+\/.*/); 

i'm not 100% clear on weather creates bundle includes assets? or wrapper allows resolving each of included assets. e.g. once call first asset loaded?:

requestgameassets(requestgameassets.keys()[0]); 

secondly second call doesn't seem result in being loaded! still required use full path asset not key in context otherwise gives me 404. if use full path asset seems load asset @ time. in other words context doesn't give me anything.. if there way include assets context in css helpful.

this seems reasonably common used case if point me example of great. webpack documentation focuses more on loading code modules assets.

cheers rod


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -