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

lqip error: Input file is missing or of an unsupported image format lqip v2.1.0 #162

Open
sebqq opened this issue Jun 10, 2020 · 5 comments

Comments

@sebqq
Copy link

sebqq commented Jun 10, 2020

Hello. I'm not able to make lqip work with dynamic requires.

const src = 'image.png'

...
<img
   alt={`${alt}-placeholder`}
   src={require(`../../assets/images/${src}?lqip`)}
   style={{ ...style, filter: 'blur(7px)' }}
 />

ends up with following error:

> Using external babel configuration
> Location: "/Users/../web/.babelrc"
Error: Input file is missing or of an unsupported image format lqip v2.1.0
Error: Input file is missing or of an unsupported image format lqip v2.1.0
Error: Input file is missing or of an unsupported image format lqip v2.1.0
Error: Input file is missing or of an unsupported image format lqip v2.1.0
Error: Input file is missing or of an unsupported image format lqip v2.1.0
Error: Input file is missing or of an unsupported image format lqip v2.1.0
Error: Input file is missing or of an unsupported image format lqip v2.1.0
Error: Input file is missing or of an unsupported image format lqip v2.1.0
Error: Input file is missing or of an unsupported image format lqip v2.1.0
Creating an optimized production build ./Users/../web/node_modules/lqip/index.js:76
  throw up;
  ^

ReferenceError: err is not defined
    at /Users/sebastian/../web/node_modules/lqip-loader/index.js:80:16
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

For webp-loader (or without ?lqip suffix), dynamic require works just fine.

Any suggestions please?

Thanks!

@Sowed
Copy link

Sowed commented Jun 12, 2020

Same here. Referencing the path directly works, but dynamic require fails. The following works,

<img
  src={require(`path-to-my-image/image.png?lqip`)}
  title={alt}
  alt={alt}
/>

And this this fails

const imgSrc = 'path-to-my-image/image.png';

...

<img
  src={require(`${imgSrc}?lqip`)}
  title={alt}
  alt={alt}
/>

I get the same logs too.

And just like you, ?webp and ?trace works fine all ways but not ?lqip. I think it's to do with lqip v2.1.0 🤔,   still digging around.

@Sowed
Copy link

Sowed commented Jun 12, 2020

@sebqq, I think there is a typo at that referenced line 80:16.

at /Users/sebastian/../web/node_modules/lqip-loader/index.js:80:16

The path resolved from the temperate literal might be incorrect, pointing to a missing file. When importing with require, the loader breaks whilst catching the error, and breaks the build too so it's hard to trace the failure in your file.

I forked the repo and ran the build against it, the build caught the error in my path (was using absolute instead of relative paths for the require), fixed it and it's all good. Until @zouhir, fixes it of course. 🙂

@Cogniveon
Copy link

I have encountered the same problem. Will it get fixed soon?

@MejanH
Copy link

MejanH commented Jul 13, 2020

Same with me too, did anyone tried with custom webpack configuration?

@MejanH
Copy link

MejanH commented Jul 13, 2020

Finally found the problem. In my markdown, my cover image name was '/images/test.jp' which lqip-loader didn't support. When I changed the cover string to only 'test-jp' and updated the index page image location it worked. you can only return filename with variable not location.

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

4 participants