title: next/image configuration in Next.js config file
body: <p>I’m implementing the Next.js Image component in my Headless project. The CMS that I’m using is WordPress. And since the image is coming from an external website, I need to specify the domain on <code>next.config.js</code>, as the documentation specifies:</p>
  <p><a href="https://nextjs.org/docs/basic-features/image-optimization" rel="nofollow noreferrer">https://nextjs.org/docs/basic-features/image-optimization</a></p>
  <pre><code>const nextConfig = {
      image: {
          domains: ['https://example.com'],
      },
  }
  </code></pre>
  <p>But in my <code>next.config.js</code> file I’ve already have this configuration:</p>
  <pre><code>const withStyles = require('@webdeb/next-styles');
  
  module.exports = withStyles({
      sass: true,
      modules: true,
  });
  </code></pre>
  <p>So my struggle is to combine this two on the config file.</p>
  <p>Just for some context, without the image configuration, I have this error:</p>
  <blockquote>
  <p>Error: Invalid src prop on <code>next/image</code>, hostname is not configured under images in your <code>next.config.js</code></p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/9VOuy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9VOuy.png" alt="enter image description here" /></a></p>
  <p>I've tried putting it together like the code bellow with the use of <code>next-compose-plugins</code>, but the error keeps showing:</p>
  <pre><code>const withStyles = require('@webdeb/next-styles');
  const withPlugins = require('next-compose-plugins');
  
  const nextConfig = {
      image: {
          domains: ['https://example.com'],
      },
  }
  
  module.exports = withPlugins([
      [withStyles({
          sass: true,
          modules: true,
      })]
  ], nextConfig);
  </code></pre>
  <p>Without the nextConfig at the end of the module.exports, the code works without a problem.</p>
  <p>A detail on the URL that I need to pass is that it's a subdomain and an homolog environment, but it doesn't need credentials to be accessed. I don't think it's the issue, tho.</p>
  <p>Since I'm new with the Next.js, I just can't figure out how this configuration needs to work.</p>