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

Error when trying to load png #40

Closed
karaggeorge opened this issue Nov 7, 2018 · 1 comment
Closed

Error when trying to load png #40

karaggeorge opened this issue Nov 7, 2018 · 1 comment

Comments

@karaggeorge
Copy link

The package works great when I run it locally, but when I run it an alpine Docker container I get the following error only for png images:

> Failed to build
{ Error: (client) ./static/iphone.png 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
[...]

My next.config.js looks like this:

const withPlugins = require('next-compose-plugins');
const optimizedImages = require('next-optimized-images');

module.exports = withPlugins([
  [optimizedImages, {
    inlineImageLimit: -1,
    optimizeImagesInDev: true
  }]
]);

And I'm importing the image like this:
<img src={require('../../static/iphone.png')} className="iphone"/>

Any ideas why this would happen?
I've already installed all these

@karaggeorge
Copy link
Author

Never mind, after installing the right packages it worked. It was a matter of some bad cache that caused it to fail again

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

1 participant