next.config.js Full (ok)

Example 1

— cms-wordpress\.env.local

WORDPRESS_API_URL=https://wpclidemo.dev/graphql
NODE_TLS_REJECT_UNAUTHORIZED=0
# Only required if you want to enable preview mode
# WORDPRESS_AUTH_REFRESH_TOKEN=
# WORDPRESS_PREVIEW_SECRET=

— cms-wordpress\next.config.js

if (!URL.canParse(process.env.WORDPRESS_API_URL)) {
  throw new Error(`
    Please provide a valid WordPress instance URL.
    Add to your environment variables WORDPRESS_API_URL.
  `);
}

const { protocol, hostname, port, pathname } = new URL(
  process.env.WORDPRESS_API_URL,
);

/** @type {import('next').NextConfig} */
module.exports = {
  reactStrictMode: true,
  images: {
    domains: [
      'wpclidemo.dev',
      "2.gravatar.com",
      "0.gravatar.com",
      "secure.gravatar.com",
    ],
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'wpclidemo.dev',
        port: '',
        pathname: '**',
      },
    ],
  },
};

Last updated

Was this helpful?