fix: image use domain caused page crash

pull/19590/head
Joel 1 year ago
parent 57b3912227
commit 55afd91894

@ -13,6 +13,8 @@ const withMDX = require('@next/mdx')({
}, },
}) })
const remoteImageURL = new URL(`${process.env.NEXT_PUBLIC_WEB_PREFIX}/**`)
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
basePath, basePath,
@ -24,6 +26,16 @@ const nextConfig = {
productionBrowserSourceMaps: false, // enable browser source map generation during the production build productionBrowserSourceMaps: false, // enable browser source map generation during the production build
// Configure pageExtensions to include md and mdx // Configure pageExtensions to include md and mdx
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
// https://nextjs.org/docs/messages/next-image-unconfigured-host
images: {
remotePatterns: [{
protocol: remoteImageURL.protocol.replace(':', ''),
hostname: remoteImageURL.hostname,
port: remoteImageURL.port,
pathname: remoteImageURL.pathname,
search: '',
}],
},
experimental: { experimental: {
}, },
// fix all before production. Now it slow the develop speed. // fix all before production. Now it slow the develop speed.

Loading…
Cancel
Save