Skip to content

Commit 540bc3e

Browse files
committed
fix routes
1 parent c74f274 commit 540bc3e

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

MyApp.Client/app/features/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Layout from "../components/layout-article"
1+
import Layout from "@/components/layout-article"
22

33
export const meta = {
44
title: 'Template Features'

MyApp.Client/app/posts/[slug]/page.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import type { Metadata } from 'next'
1212
import PostType from "@/types/post"
1313

1414
type Props = {
15-
params: {
15+
params: Promise<{
1616
slug: string
17-
}
17+
}>
1818
}
1919

2020
export async function generateMetadata({ params }: Props): Promise<Metadata> {
21-
const post = getPostBySlug(params.slug, ['title', 'ogImage']) as unknown as PostType
21+
const { slug } = await params
22+
const post = getPostBySlug(slug, ['title', 'ogImage']) as unknown as PostType
2223
const title = `${post.title} | Next.js Example with ${CMS_NAME}`
2324

2425
return {
@@ -38,7 +39,8 @@ export async function generateStaticParams() {
3839
}
3940

4041
export default async function Post({ params }: Props) {
41-
const post = getPostBySlug(params.slug, [
42+
const { slug } = await params
43+
const post = getPostBySlug(slug, [
4244
'title',
4345
'date',
4446
'slug',

MyApp.Client/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./.next/types/routes.d.ts";
3+
import "./dist/dev/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

MyApp.Client/next.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ console.log('next.config.mjs', process.env.NODE_ENV, buildLocal, API_URL, proces
2020
* @type {import('next').NextConfig}
2121
**/
2222
const nextConfig = {
23+
// Configure pageExtensions to include MDX files
24+
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
25+
2326
// Enable static export (replaces next export command)
2427
output: isProd ? 'export' : undefined,
2528

MyApp.Client/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
"**/*.ts",
4040
"**/*.tsx",
4141
".next/types/**/*.ts",
42-
".next/dev/types/**/*.ts"
42+
".next/dev/types/**/*.ts",
43+
"dist/types/**/*.ts",
44+
"dist/dev/types/**/*.ts"
4345
]
4446
}

0 commit comments

Comments
 (0)