-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is missing so that the build process does not exceed 1 minute with "responsive-loader" in my app Nuxtjs? #124
Comments
@johan-Rm Hello, But for 1500+ images I would look into using something like this https://aws.amazon.com/solutions/implementations/serverless-image-handler/ Anyways make sure you are using it with the Sharp adapter, and you can use the |
We have 300+ images (expecting that to tripple) and were hoping this could be sped up by not resizing all the pics that haven't changed. Is there no way to ignore the images already present during build? All the pics are cached in |
thank you for your feedback and your valuable information, @pkpowell I will also explore this track there, if I find a solution I will inform you |
Great, thanks!
… On 2 Nov 2020, at 19:41, REMY Johan ***@***.***> wrote:
thank you for your feedback and your valuable information, @pkpowell <https://github.com/pkpowell> I will also explore this track there, if I find a solution I will inform you
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#124 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAGUMMFXMJFHZEQWMPTFWHDSN34ONANCNFSM4S7STAPA>.
|
I did some sleuthing and discovered that all images are being converted to all sizes referenced in the site. Any ideas on how to optimise this? Is this a webpack issue or maybe an issue with Cheers My webpack config is
The images are loaded via
This image is only required in one template at 530w so should only emit 2 files (1 jpg 1 webp).
|
@pkpowell Webpack is unable to resolve the image at build time, so it creates a context which includes every image within the referenced directory (in this case "~/assets/uploads/"). So if you are using a dynamic require for three sizes (840, 1440, 530...), all with the same folder path, then webpack generates a version of every file in the referenced directory for each one of those sizes. Here is a more detailed description on stackoverflow. Also, I am wondering the same thing regarding caching generated images, specifically to speed up build time on Netlify. Did you find any solutions there? |
After adding avif to the build tasks, the build time has exceeded 2 minutes. Would really love a cache feature to avoid constant rebuilds. |
Managed to use the cache option to lower rebuild time. As in my comment in #52 |
Hey guys, You can use This will cache the result object but not the image files, I have been debating on how to implement this, if I save the generated images on the cache, and copy them in, there is an expensive copy operation for every build, and not ideal when you have to many images. That being said, having the results in cache, you can copy the generated images to
default cache location is Any feedback is appreciated as we figure out a good way to handle this the best way possible. |
I'm getting 404s for my images with I'm assuming this has something to do with the images not copied over to webpack dev server's memory file system if |
@Trinovantes Yes, the images are only produced once, when they are not found in the cache, or when the options change (cache key). What this saves in the cache is the generated results object:
I am still debating if adding an option to also store the generated images on the cache and copying them over for every build., this does unnecessary disk read/writes but it is simpler for the end-user. For now, you can create a script that copies files generated by webpack build to your static folder. And running only when adding new images. |
I tried setting
|
@dazuaz Thanks for your work on this. For my current use case, caching the generated images would be really helpful. I use responsive loader with a static site generator and a file-based CMS, so when CMS editors add a new image, the site rebuilds and generates responsive sizes for that image. Right now I am using a system that combines 'responsive-loader' with a PR of the recently deprecated 'cache-loader' that allows for caching of generated files. Here is the PR that adds the caching of files. This system isn't perfect though, and I'm with you in that there is probably a more efficient approach, but even using this caching method helps speed up site generating on content changes. |
I've been using v3 for awhile now and it has greatly reduced my build times. One pain point I've encountered is that If I add new images while using webpack-dev-server, responsive-loader generates a cached file in Can you add a new option that allows me to disable emitting new cache files but still try to check |
You could maybe hardlink the images to the ones in the cache? This would save a copy, at least. |
With my nuxt js project, in my "assets" folder I have 150 images for a weight of 122M, I use the "responsive-loader", but when I run the "build" command the process is too long. How can I debug?
why does it take so long to load 150 images? I will need to load 1500 images in the future ...
Moreover the images that I have already optimized with "jpegoptim -quality 20" still exceed the recommended size, how do you do?
Can you tell me the best practice?
The text was updated successfully, but these errors were encountered: