fix: dynamicParams bug

This commit is contained in:
iCrawl
2022-11-29 00:36:23 +01:00
parent 2f4bdf7394
commit 1efa95337f
4 changed files with 2 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ export default withBundleAnalyzer({
ignoreDuringBuilds: true,
},
cleanDistDir: true,
outputFileTracing: true,
experimental: {
appDir: true,
serverComponentsExternalPackages: ['@microsoft/api-extractor-model', 'jju', 'shiki'],

View File

@@ -5,8 +5,6 @@ import Link from 'next/link';
import { notFound } from 'next/navigation';
import { PACKAGES } from '~/util/constants';
export const dynamicParams = false;
export async function generateStaticParams() {
return PACKAGES.map((packageName) => ({ package: packageName }));
}

View File

@@ -7,6 +7,7 @@ export default async function middleware(request: NextRequest) {
}
if (PACKAGES.some((pkg) => request.nextUrl.pathname.includes(pkg))) {
// eslint-disable-next-line prefer-named-capture-group
const packageName = /\/docs\/packages\/([^/]+)\/.*/.exec(request.nextUrl.pathname)?.[1] ?? 'builders';
const res = await fetch(`https://docs.discordjs.dev/api/info?package=${packageName}`);
const data: string[] = await res.json();