Collect src for all images at build time

I am looking into a way to collect the src attribute for images in every component in my project at build time.

for example if I have two vue files each containing multiple images in the template, i need to be able to collect the src for all those images at build time.

Is this something that can be done with vue-loader?

You’d definitely need to involved Webpack, but why do you need to do this? There could be another approach.

I am trying to determine which images i need to preload in beforeEnter of each route.

if the img src is static, you can use npm: vue-template-compiler to get the ast by template.
if img src is binding, maybe should new a vue instance to get the vnode

image asset is static… eg: <img src="@/assets/images/test.jpg" />

how would I use the vue-template-compiler to extract a list of used images per vue component?

I looked into vue template compiler… it seems that we can only pass configuration options… that doesn’t solve my problem… would appreciate if a vue build expert can chime in with his experience.