-
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
Requiring image in server app #77
Comments
Pushed an example repo here: https://github.com/joebanks10/next-optimized-images-express |
This plugin is based on different webpack loaders. So, if you also build your server with webpack, it could work. But by default or when following the example you have linked, this is not the case and Next.js doesn't support building the server with webpack out of the box. So you would have to do that manually. Another solution would be that you optimize the images with |
Is it possible to import/require an image in a server-side app? For instance, can you have
require('static/myimg.jpg') in
server.js` in this example: https://github.com/zeit/next.js/tree/canary/examples/custom-server-expressI'm specifically trying to import an image in an api endpoint and send the image data to my client-side app.
The text was updated successfully, but these errors were encountered: