edm00se/netlify-plugin-gridsome-cache

Add custom image path?

Closed this issue · 2 comments

Hi! I installed this plugin on my Gridsome site, but unfortunately it hasn't reduced build times at all (they're around 7 minutes, due mostly to the large amount of image files being processed). I do see the messages that the plugin is working in the build logs, but it doesn't seem to be actually doing anything aside from logging messages.

I'm guessing it's because I've set the Webpack image directory to be different than the default (which seems to be required in order to allow Gridsome to do dynamic image handling); from my gridsome.config.js:

chainWebpack: config => {
  config.resolve.alias.set('@images', '@/assets/images')
},

Then, when linking images, it goes something like this:

<g-image :src="require(`!!assets-loader!@images/blog/${image.path}`)" alt="" />

So as you may be able to tell, my images are actually inside of src/assets/images/ rather than the static directory.

Again, while it's hard to tell for sure, my guess is this custom setup is the problem. So my question is: can there be a config setup for this plugin to allow setups like mine to work? (Or is there any other workaround you might be able to suggest?)

Thanks in advance!

I don't think you're doing anything wrong but it appears you've run into a situation I've seen before and may well be beyond what this plugin can do. What you're describing seems directly related to gridsome/gridsome#292. According to this comment in that issue thread it seems that between gridsome, webpack, and g-image, there's some funky stuff happening in which the images aren't cached correctly, due to the internals of how the images are registered between them all.

Once that issue is completed and/or fixed and gridsome, webpack, and g-image all are working together, I suspect this issue will disappear. If however this is still a problem then, this issue can be re-opened.

Thank you for taking the time to report this, I'll pin the issue in case anyone else comes looking for it.

Cool, I appreciate you taking the time to look into it and write that out. Thanks!