0

I'm working on an e-commerce project for a client using nextJs. I was trying to optimize images using next-optimized-images. Though it works fine I get the error in terminal. I'm new to webpack and I have configured my next.config based on https://github.com/cyrilwanner/next-optimized-images

next.config

require('dotenv').config();

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

const nextConfig = {
  env: {
    PORT: process.env.PORT,
    REST_URL: process.env.REST_URL,
    GRAPHQL_URL: process.env.GRAPHQL_URL,
    FRONTEND_URL: process.env.FRONTEND_URL,
    RAZORPAY_KEY: process.env.RAZORPAY_KEY,
    RAZORPAY_SECRET: process.env.RAZORPAY_SECRET,
    MAGENTO_ADMIN_TOKEN: process.env.MAGENTO_ADMIN_TOKEN,
  },
};

module.exports = withPlugins(
  [
    [
      withOptimizedImages,
      {
        inlineImageLimit: 8192,
        imagesFolder: 'images',
        imagesName: '[name]-[hash].[ext]',
        handleImages: ['jpeg', 'png', 'svg', 'webp', 'gif'],
        optimizeImages: true,
        optimizeImagesInDev: true,
        mozjpeg: {
          quality: 80,
        },
        optipng: {
          optimizationLevel: 3,
        },
        pngquant: false,
        webp: {
          preset: 'default',
          quality: 75,
        },
      },
    ],
  ],
  nextConfig
);

TypeError: Converting circular structure to JSON - Webpack

Sharzil Shaikh
  • 35
  • 1
  • 2
  • 9
  • See this: https://stackoverflow.com/questions/10392293/stringify-convert-to-json-a-javascript-object-with-circular-reference – user369142 Apr 23 '20 at 08:52
  • You might need to look at `importing mp4` files. Something like this should do https://github.com/jeremybarbet/next-videos. Currently There are no loaders to handle this file and so webpack throws an error. – Panther Apr 23 '20 at 08:55
  • @Panther It's not just mp4. I'm getting the same error for scss as well. eg- ./public/styles/modal.scss?size=980. It's not visible in ss. – Sharzil Shaikh Apr 23 '20 at 09:28
  • @user369142 The error is with the webpack modules. How do I resolve that? – Sharzil Shaikh Apr 23 '20 at 09:31

0 Answers0