Skip to content
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

optimizeImagesInDev does not work #160

Open
sesigl opened this issue Jun 1, 2020 · 1 comment
Open

optimizeImagesInDev does not work #160

sesigl opened this issue Jun 1, 2020 · 1 comment

Comments

@sesigl
Copy link

sesigl commented Jun 1, 2020

Hey,

First of all, amazing plugin, thanks a lot!

I try to optimize my Nextjs project and was surprised, that images are smaller even though, I use the default value optimizeImagesInDev: false.

I start my application by using now dev that should do a next dev .

I try to get my dev development as smooth and fast as possible. I also tried to workaround with dynamic paths, only appending ?resize if it is not a production build. But this fails during build time for some reason... I think it's related to dynamic imports that misbehave.

What is your favorite setup?

Thanks in advance!

@tiotdev
Copy link

tiotdev commented Jun 6, 2020

I'm having the same problem, with several hundred images being optimised, the development build took several minutes. I tried both passing no options and passing optimizeImagesInDev: false which is supposed to be the default, but images were still being optimized.

Solved it with this:

const imgUrl =
    process.env.NODE_ENV === 'production'
      ? require(`../../img/posts/${permlink}.jpg?resize&size=500`)
      : require(`../../img/posts/${permlink}.jpg?original`);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants