mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix: dynamicParams bug
This commit is contained in:
@@ -15,6 +15,7 @@ export default withBundleAnalyzer({
|
||||
ignoreDuringBuilds: true,
|
||||
},
|
||||
cleanDistDir: true,
|
||||
outputFileTracing: true,
|
||||
experimental: {
|
||||
appDir: true,
|
||||
serverComponentsExternalPackages: ['@microsoft/api-extractor-model', 'jju', 'shiki'],
|
||||
|
||||
@@ -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 }));
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user