rsnext/examples/cms-wordpress/next.config.js
Steven a3aa6590ff
chore(next/image)!: mark domains as deprecated in favor remotePatterns (#57062)
We already had `domains` as "not recommended" but this PR marks it as "deprecated" and prints a warning if its detected.

I also updated all examples to switch from `domains` to `remotePatterns`.
2023-10-19 20:24:48 +00:00

24 lines
513 B
JavaScript

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 = {
images: {
remotePatterns: [
{
protocol: protocol.slice(0, -1),
hostname,
port,
pathname: `${pathname}/**`,
},
],
},
}