-
Notifications
You must be signed in to change notification settings - Fork 91
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
Optimize images only when required #189
Comments
After some search, it turns out it's a webpack thing. Webpack will process all images in the folder when dynamic require is used with a variable. |
This is indeed a webpack limitation. The only way would be to move all images you want to optimize into a separate folder and use that folder as a prefix in your require statement ( |
OK. Guess I'll roll my own solution server side with sharp. Thanks. |
Hi,
I just installed this package to optimize images on a page of my project. I used
require('path/to/image?webp');
. I expected images to be optimized only when I use therequire
statement and not when I reference the path directly, but all my images are being optimized. Is there a way to solve this ?Thanks.
The text was updated successfully, but these errors were encountered: