I'm currently facing an issue with setting dynamic routes using Exportpathmap() in nex.config.js. The static routes are working as expected, but when I attempt to apply dynamic routing, the URL redirects me back to the main URL.
If anyone has a solution for this problem, please help me out. Thanks in advance!
Below is my next.config.js:
return {
reactStrictMode: true,
env: env,
trailingSlash : true,
eslint: {
ignoreDuringBuilds: true,
},
swcMinify: true,
images: {
domains: ['cdn.pixabay.com', 'pixabay.com', 'cdn.landrrapp.io'],
loader: 'akamai',
path: '',
},
exportPathMap: async function (
defaultPathMap,
{ dev, dir, outDir, distDir, buildId }
) {
return {
'/404': { page: '/404' },
'/forgot-password': { page: '/forgot-password' },
'/login': { page: '/login' },
'/editor/[id]': { page: '/editor/[id]' },
}
},
}
The specific issue seems to be related to this line: '/editor/[id]': { page: '/editor/[id]' },
NEXT JS: Build exportPathMap for a dynamic page Route The link above looks promising, but I'm having trouble understanding the line "
import { PAGE_ROUTES } from '../constants/config';
" in that file.