pageExtensions
默认情况下,Next.js 接受具有以下扩展名的文件:.tsx
、.ts
、.jsx
、.js
。可以修改它以允许其他扩展,例如 markdown (.md
, .mdx
)。
¥By default, Next.js accepts files with the following extensions: .tsx
, .ts
, .jsx
, .js
. This can be modified to allow other extensions like markdown (.md
, .mdx
).
const withMDX = require('@next/mdx')()
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ['ts', 'tsx', 'mdx'],
experimental: {
mdxRs: true,
},
}
module.exports = withMDX(nextConfig)