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

Can't set up next-optimized-images #221

Open
subhasishdas159 opened this issue Nov 25, 2020 · 0 comments
Open

Can't set up next-optimized-images #221

subhasishdas159 opened this issue Nov 25, 2020 · 0 comments

Comments

@subhasishdas159
Copy link

I'm trying to set up next-optimized-images 2.6.2 with next js 9.3.6, after this I'd like to do "next build" and "next export" and generate a static site. After this I hope to host it with amazon S3. I would like next-optimized-images optimize the images while developing too.

My next.config.js file looks like

const withPlugins = require('next-compose-plugins')
const optimizedImages = require('next-optimized-images')
const withSass = require('@zeit/next-sass')
const withCSS = require('@zeit/next-css')
const path = require('path')

module.exports = withPlugins(
  [
    [withSass],
    [
      optimizedImages,
      {
        optimizeImagesInDev: true
      }
    ],
    [withCSS]
  ],
  {
    webpack (config, options) {
      config.resolve.modules.push(path.resolve('./'))
      return config
    }
  }
)

I have also installed the following Optimization Packages

"image-trace-loader": "^1.0.2",
"imagemin-mozjpeg": "^9.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^8.0.0",
"webp-loader": "^0.6.0",

I have both webp and png images in my code which I'm importing this way

import infoImage1 from 'assets/img/pages/covid/infoImage1.png'

After doing it, when I run "npm run dev" it shows "[ event ] build page: /home" and then nothing else happens, except for the cursor just blinks.

In the chrome browser When I try to go to localhost, the page doesn't load. It just shows the loading spinner which keeps spinning anticlockwise on the tab. Nothing appears on the page.

No error message is shown either in the browser console or in the terminal .

Can anyone please tell me where I'm doing wrong and how to make next-optimized-images work with next js in a static site setup?

Thanks in advance!

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